:: (a -> Bool) -> (a -> Bool) -> (a -> Bool) -package:foldl is:exact -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"
Extend a generic query by a type-specific query. The function created by extQ def ext behaves like the generic query def if its argument cannot be cast to the type b, and like the type-specific query ext otherwise. The name extQ is short for "extend query".

Examples

>>> extQ (const True) not True
False
>>> extQ (const True) not 'a'
True