@@ -58,7 +58,7 @@ checkBody
58 -> M [Annotation.Located Warning]
58 -> M [Annotation.Located Warning]
59checkBody interfaces =
59checkBody interfaces =
60 checkExpr . Module.program
60 checkExpr . Module.program
62 checkExpr :: Canonical.Expr -> M [Annotation.Located Warning]
62 checkExpr :: Canonical.Expr -> M [Annotation.Located Warning]
63 checkExpr (Annotation.A r e) =
63 checkExpr (Annotation.A r e) =
@@ -79,8 +79,9 @@ checkBody interfaces =
80 General.Let defs e ->
80 General.Let defs e ->
81 concat <$> sequence [ps, rhssResults, checkExpr e]
81 concat <$> sequence [ps, rhssResults, checkExpr e]
83− ps = mapMaybeM (\(Canonical.Definition p _ _) -> checkMatch r [p]) defs
83+ ps = mapMaybeM (\(Canonical.Definition p _ _) -> checkMatch r [p]) defs
84 rhssResults = concatMapM (\(Canonical.Definition _ e _) -> checkExpr e) defs
85 rhssResults = concatMapM (\(Canonical.Definition _ e _) -> checkExpr e) defs
86 General.Case e branches ->
87 General.Case e branches ->
@@ -88,7 +89,7 @@ checkBody interfaces =
88 result <- checkMatch r ps
89 result <- checkMatch r ps
89 branchResults <- concatMapM (checkExpr . snd) branches
90 branchResults <- concatMapM (checkExpr . snd) branches
90 return (eResults ++ maybeCons result branchResults)
91 return (eResults ++ maybeCons result branchResults)
91− where ps = map fst branches
92+ where ps = map fst branches
93 General.Data _ctor es ->
94 General.Data _ctor es ->
94 concatMapM checkExpr es
95 concatMapM checkExpr es
@@ -115,10 +116,12 @@ checkBody interfaces =
115 ctorToAdt :: Var.Canonical -> Maybe (Module.AdtInfo String)
116 ctorToAdt :: Var.Canonical -> Maybe (Module.AdtInfo String)
116 ctorToAdt =
117 ctorToAdt =
117 \(Var.Canonical {Var.home,Var.name}) -> Map.lookup name =<< Map.lookup home m
118 \(Var.Canonical {Var.home,Var.name}) -> Map.lookup name =<< Map.lookup home m
119 -- Maps home to ctor name to the adt to which that ctor belongs
120 -- Maps home to ctor name to the adt to which that ctor belongs
120 m :: Map.Map Var.Home (Map.Map String (Module.AdtInfo String))
121 m :: Map.Map Var.Home (Map.Map String (Module.AdtInfo String))
121− m = builtins `Map.union` fromModules where
123+ builtins `Map.union` fromModules
123 builtins = Map.empty
126 builtins = Map.empty
@@ -227,7 +230,7 @@ checkBody interfaces =
227 checkMatch :: Region.Region -> [CanonicalPattern] -> M (Maybe (Annotation.Located Warning))
230 checkMatch :: Region.Region -> [CanonicalPattern] -> M (Maybe (Annotation.Located Warning))
228 checkMatch region =
231 checkMatch region =
229 go [Anything]
232 go [Anything]
231 go :: [CanonicalPat] -> [CanonicalPattern] -> M (Maybe (Annotation.Located Warning))
234 go :: [CanonicalPat] -> [CanonicalPattern] -> M (Maybe (Annotation.Located Warning))
232 go unhandled ps =
235 go unhandled ps =
233 case (unhandled, ps) of
236 case (unhandled, ps) of