:: (a -> Bool) -> (a -> Bool) -> (a -> Bool) -package:leancheck

Lift boolean or over predicates.
Try to run a function, on pattern match fail run the provided handler instead.
>>> reverse `onMismatch` (\"needle" -> "Found It") $ "haystack"
"kcatsyah"

>>> reverse `onMismatch` (\"needle" -> "Found It") $ "needle"
"Found It"
Infix version of flip onMismatch It tries the patterns in order from left to right. The last handler in the chain MUST be total or the chain could fail with a PatternMatchFail
>>> (\1 -> "got 1") ||> (\2 -> "got 2") ||> show $ 1
"got 1"

>>> (\1 -> "got 1") ||> (\1 -> "again") ||> (\2 -> "got 2") ||> show $ 2
"got 2"

>>> (\1 -> "got 1") ||> (\1 -> "again") ||> (\2 -> "got 2") ||> show $ 3
"3"
>>> fold (handles (filtered even) sum) [1..10]
30
>>> foldM (handlesM (filtered even) (L.mapM_ print)) [1..10]
2
4
6
8
10
Extend a generic query by a type-specific case