My newbie’s attempt to express the behavior of operator ||
from C/C++ in Haskell:
orElse :: Bool -> (a -> Bool) -> (a -> Bool)
orElse True _ = const True
orElse False pred = pred
Can this be generalized so that it can accept a -> b -> Bool
, a -> b -> c -> Bool
and so on as its 2nd argument?
Looked at overloading techniques, HKTs et. al. – nothing seems to deal with generalization by kind…