on master help sign in
Begin using the new boundVarList function
commitb2f3ff35dc40be1933892876d2bfd4b3a57e7df7 authorEvan Czaplicki <info@elm-lang.org> dateMon 10 Feb 2014, 00:17 (13 years ago) parent9dd5dff
2 files changed+5−7
compiler/Build/Source.hs+1−2 compiler/Transform/Check.hs+4−5
compiler/Build/Source.hs+1−2
@@ -2,7 +2,6 @@
22module Build.Source (build) where
33
44import qualified Data.Map as Map
5−import qualified Data.Set as Set
65import System.FilePath as FP
76import Text.PrettyPrint (Doc)
87
@@ -33,7 +32,7 @@ build noPrelude interfaces source =
3332
3433 let exports'
3534 | null exs =
36− let get = Set.toList . Pattern.boundVars in
35+ let get = Pattern.boundVarList in
3736 concat [ get pattern | Definition (Expr.Definition pattern _ _) <- decls ] ++
3837 concat [ map fst ctors | Datatype _ _ ctors <- decls ] ++
3938 [ name | TypeAlias name _ (Type.Record _ _) <- decls ]
compiler/Transform/Check.hs+4−5
@@ -32,7 +32,7 @@ dupErr err x =
3232
3333duplicates :: [D.Declaration] -> [String]
3434duplicates decls =
35− map msg (dups (portNames ++ concatMap getNames defPatterns)) ++
35+ map msg (dups (portNames ++ concatMap Pattern.boundVarList defPatterns)) ++
3636 case mapM exprDups (portExprs ++ defExprs) of
3737 Left name -> [msg name]
3838 Right _ -> []
@@ -50,14 +50,13 @@ duplicates decls =
5050 D.Out name expr _ -> (name, [expr])
5151 D.In name _ -> (name, [])
5252
53− getNames = Set.toList . Pattern.boundVars
54−
55− exprDups :: E.LExpr -> Either String E.LExpr
53+ exprDups :: E.Expr -> Either String E.Expr
5654 exprDups expr = Expr.crawlLet defsDups expr
5755
5856 defsDups :: [E.Def] -> Either String [E.Def]
5957 defsDups defs =
60− case dups $ concatMap (\(E.Definition name _ _) -> getNames name) defs of
58+ let varsIn (E.Definition pattern _ _) = Pattern.boundVarList pattern in
59+ case dups $ concatMap varsIn defs of
6160 [] -> Right defs
6261 name:_ -> Left name
6362