@@ -223,6 +223,8 @@ missingAlternative env mn ca uncovered
223223 where
224224 mcases = missingCases env mn uncovered ca
225225
226+
227+
226228-- |
227229-- Main exhaustivity checking function
228230-- Starting with the set `uncovered = { _ }` (nothing covered, one `_` for each function argument),
@@ -235,9 +237,10 @@ checkExhaustive env mn numArgs cas = makeResult . first nub $ foldl' step ([init
235237 step :: ([[Binder]], (Maybe Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Maybe Bool, [[Binder]]))
236238 step (uncovered, (nec, redundant)) ca =
237239 let (missed, pr) = unzip (map (missingAlternative env mn ca) uncovered)
238− cond = or <$> sequenceA pr
239− in (concat missed, (liftA2 (&&) cond nec,
240− if fromMaybe True cond then redundant else caseAlternativeBinders ca : redundant))
240+ (missed', approx) = splitAt 10000 (concat missed)
241+ cond = liftA2 (&&) (or <$> sequenceA pr) nec
242+ in (missed', (if null approx then cond else Nothing,
243+ if fromMaybe True cond then redundant else caseAlternativeBinders ca : redundant))
241244#if __GLASGOW_HASKELL__ < 710
242245 where
243246 sequenceA = foldr (liftA2 (:)) (pure [])