@@ -31,13 +31,13 @@ import Language.PureScript.Kinds
3131import Language.PureScript.Types as P
3232import Language.PureScript.Errors
3333
34−-- | There are two modes of failure for the redudancy check:
34+-- | There are two modes of failure for the redundancy check:
3535--
3636-- 1. Exhaustivity was incomplete due to too many cases, so we couldn't determine redundancy.
3737-- 2. We didn't attempt to determine redundancy for a binder, e.g. an integer binder.
3838--
3939-- We want to warn the user in the first case.
40−data RedudancyError = Incomplete | Unknown
40+data RedundancyError = Incomplete | Unknown
4141
4242-- |
4343-- Qualifies a propername from a given qualified propername and a default module name
@@ -106,7 +106,7 @@ genericMerge f bsl@((s, b):bs) bsr@((s', b'):bs')
106106-- Find the uncovered set between two binders:
107107-- the first binder is the case we are trying to cover, the second one is the matching binder
108108--
109−missingCasesSingle :: Environment -> ModuleName -> Binder -> Binder -> ([Binder], Either RedudancyError Bool)
109+missingCasesSingle :: Environment -> ModuleName -> Binder -> Binder -> ([Binder], Either RedundancyError Bool)
110110missingCasesSingle _ _ _ NullBinder = ([], return True)
111111missingCasesSingle _ _ _ (VarBinder _) = ([], return True)
112112missingCasesSingle env mn (VarBinder _) b = missingCasesSingle env mn NullBinder b
@@ -175,7 +175,7 @@ missingCasesSingle _ _ b _ = ([b], Left Unknown)
175175-- redundant or not, but uncovered at least. If we use `y` instead, we'll need to have a redundancy checker
176176-- (which ought to be available soon), or increase the complexity of the algorithm.
177177--
178−missingCasesMultiple :: Environment -> ModuleName -> [Binder] -> [Binder] -> ([[Binder]], Either RedudancyError Bool)
178+missingCasesMultiple :: Environment -> ModuleName -> [Binder] -> [Binder] -> ([[Binder]], Either RedundancyError Bool)
179179missingCasesMultiple env mn = go
180180 where
181181 go [] [] = ([], pure True)
@@ -210,10 +210,10 @@ isExhaustiveGuard (Right _) = True
210210-- |
211211-- Returns the uncovered set of case alternatives
212212--
213−missingCases :: Environment -> ModuleName -> [Binder] -> CaseAlternative -> ([[Binder]], Either RedudancyError Bool)
213+missingCases :: Environment -> ModuleName -> [Binder] -> CaseAlternative -> ([[Binder]], Either RedundancyError Bool)
214214missingCases env mn uncovered ca = missingCasesMultiple env mn uncovered (caseAlternativeBinders ca)
215215
216−missingAlternative :: Environment -> ModuleName -> CaseAlternative -> [Binder] -> ([[Binder]], Either RedudancyError Bool)
216+missingAlternative :: Environment -> ModuleName -> CaseAlternative -> [Binder] -> ([[Binder]], Either RedundancyError Bool)
217217missingAlternative env mn ca uncovered
218218 | isExhaustiveGuard (caseAlternativeResult ca) = mcases
219219 | otherwise = ([uncovered], snd mcases)
@@ -229,13 +229,13 @@ missingAlternative env mn ca uncovered
229229checkExhaustive :: forall m. (MonadWriter MultipleErrors m) => Bool -> Environment -> ModuleName -> Int -> [CaseAlternative] -> m ()
230230checkExhaustive hasConstraint env mn numArgs cas = makeResult . first nub $ foldl' step ([initialize numArgs], (pure True, [])) cas
231231 where
232− step :: ([[Binder]], (Either RedudancyError Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Either RedudancyError Bool, [[Binder]]))
232+ step :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Either RedundancyError Bool, [[Binder]]))
233233 step (uncovered, (nec, redundant)) ca =
234234 let (missed, pr) = unzip (map (missingAlternative env mn ca) uncovered)
235235 (missed', approx) = splitAt 10000 (nub (concat missed))
236− cond = liftA2 (&&) (or <$> sequenceA pr) nec
236+ cond = or <$> sequenceA pr
237237 in (missed', ( if null approx
238− then cond
238+ then liftA2 (&&) cond nec
239239 else Left Incomplete
240240 , if either (const True) id cond
241241 then redundant
@@ -243,7 +243,7 @@ checkExhaustive hasConstraint env mn numArgs cas = makeResult . first nub $ fold
243243 )
244244 )
245245
246− makeResult :: ([[Binder]], (Either RedudancyError Bool, [[Binder]])) -> m ()
246+ makeResult :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> m ()
247247 makeResult (bss, (rr, bss')) =
248248 do unless (hasConstraint || null bss) tellNonExhaustive
249249 unless (null bss') tellRedundant