@@ -22,7 +22,7 @@ module Language.PureScript.Sugar.BindingGroups (
24import Data.Graph
24import Data.Graph
25−import Data.Generics
25+import Data.Generics (mkM)
26import Data.Generics.Extras
26import Data.Generics.Extras
27import Data.List (nub, intersect)
27import Data.List (nub, intersect)
28import Data.Maybe (isJust, mapMaybe)
28import Data.Maybe (isJust, mapMaybe)
@@ -90,7 +90,9 @@ collapseBindingGroupsForValue (Let ds val) = Let (collapseBindingGroups ds) val
90collapseBindingGroupsForValue other = other
90collapseBindingGroupsForValue other = other
92usedIdents :: ModuleName -> Declaration -> [Ident]
92usedIdents :: ModuleName -> Declaration -> [Ident]
93−usedIdents moduleName = nub . everything (++) (mkQ [] usedNames)
93+usedIdents moduleName =
94+ let (f, _, _, _, _) = everythingOnValues (++) (const []) usedNames (const []) (const []) (const [])
95 usedNames :: Value -> [Ident]
97 usedNames :: Value -> [Ident]
96 usedNames (Var (Qualified Nothing name)) = [name]
98 usedNames (Var (Qualified Nothing name)) = [name]
@@ -98,7 +100,9 @@ usedIdents moduleName = nub . everything (++) (mkQ [] usedNames)
98 usedNames _ = []
100 usedNames _ = []
100usedProperNames :: ModuleName -> Declaration -> [ProperName]
102usedProperNames :: ModuleName -> Declaration -> [ProperName]
101−usedProperNames moduleName = nub . everything (++) (mkQ [] usedNames)
103+usedProperNames moduleName =
104+ let (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames)
103 usedNames :: Type -> [ProperName]
107 usedNames :: Type -> [ProperName]
104 usedNames (ConstrainedType constraints _) = flip mapMaybe constraints $ \qual ->
108 usedNames (ConstrainedType constraints _) = flip mapMaybe constraints $ \qual ->