
17 Jan
2008
17 Jan
'08
9:46 a.m.
Neil Mitchell wrote:
Hi
passall, passany :: [a -> Bool] -> a -> Bool passall ps v = and $ map ($v) ps passany ps v = or $ map ($v) ps or something similar defined anywhere? Such that one can write
nearly; using Prelude: passall ps v = all ($v) ps passany ps v = any ($v) ps
One thing I have often wanted is something like:
or1 a b x = a x || b x or2 a b x y = a x y || b x y
yep, there's the idea of putting Bools in a typeclass that allows you to (||) functions-returning-Bool-class-instance for example, which I haven't used much but seems like a good idea (though potentially confusing, especially if the Prelude-Bool-specific names are reused) ~Isaac