1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00
This commit is contained in:
Rob Rix 2017-09-11 09:50:14 -04:00
parent 8e12798a05
commit c8706d6c4b

View File

@ -35,6 +35,7 @@ bindings :: BindingF f recur -> [(Metavar, recur)]
bindings (Let vars _) = vars
bindings _ = []
freeMetavariables :: (Foldable syntax, Functor syntax, Recursive t, Base t ~ BindingF syntax) => t -> Set.Set Metavar
freeMetavariables = cata $ \ diff -> case diff of
Let bindings body -> foldMap snd bindings <> foldr Set.delete (fold body) (fst <$> bindings)