import qualified Data.Set as Set closure f xs s = let xs' = concatMap f xs s' = Set.union s (Set.fromList xs') in if Set.size s == Set.size s' then s else closure f (Set.toList (Set.difference s' s)) s' main :: IO () main = do print "not sure what example to use"