@@ -228,8 +228,8 @@ missingAlternative env mn ca uncovered
228-- it partitions that set with the new uncovered cases, until it consumes the whole set of clauses.
228-- it partitions that set with the new uncovered cases, until it consumes the whole set of clauses.
229-- Then, returns the uncovered set of case alternatives.
229-- Then, returns the uncovered set of case alternatives.
231−checkExhaustive :: forall m. (MonadWriter MultipleErrors m) => Environment -> ModuleName -> [CaseAlternative] -> m ()
231+checkExhaustive :: forall m. (MonadWriter MultipleErrors m) => Environment -> ModuleName -> Int -> [CaseAlternative] -> m ()
232−checkExhaustive env mn cas = makeResult . first nub $ foldl' step ([initial], (pure True, [])) cas
232+checkExhaustive env mn numArgs cas = makeResult . first nub $ foldl' step ([initialize numArgs], (pure True, [])) cas
234 step :: ([[Binder]], (Maybe Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Maybe Bool, [[Binder]]))
234 step :: ([[Binder]], (Maybe Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Maybe Bool, [[Binder]]))
235 step (uncovered, (nec, redundant)) ca =
235 step (uncovered, (nec, redundant)) ca =
@@ -240,11 +240,6 @@ checkExhaustive env mn cas = makeResult . first nub $ foldl' step ([initial], (p
241 sequenceA = foldr (liftA2 (:)) (pure [])
241 sequenceA = foldr (liftA2 (:)) (pure [])
244− initial = initialize numArgs
246− numArgs = length . caseAlternativeBinders . head $ cas
248 makeResult :: ([[Binder]], (Maybe Bool, [[Binder]])) -> m ()
243 makeResult :: ([[Binder]], (Maybe Bool, [[Binder]])) -> m ()
249 makeResult (bss, (_, bss')) =
244 makeResult (bss, (_, bss')) =
250 do unless (null bss) tellExhaustive
245 do unless (null bss) tellExhaustive
@@ -274,7 +269,7 @@ checkExhaustiveDecls env mn ds =
274 in mapM_ f' ds
269 in mapM_ f' ds
276 checkExpr :: Expr -> m Expr
271 checkExpr :: Expr -> m Expr
277− checkExpr c@(Case _ cas) = checkExhaustive env mn cas >> return c
272+ checkExpr c@(Case expr cas) = checkExhaustive env mn (length expr) cas >> return c
278 checkExpr other = return other
273 checkExpr other = return other