
29 Dec
2011
29 Dec
'11
7:54 p.m.
On Thu, 29 Dec 2011 11:03:38 -0500
Brent Yorgey
On Thu, Dec 29, 2011 at 06:45:27AM +0100, Manfred Lotz wrote:
or' :: Monad m => ( a -> m Bool) -> [a] -> [m Bool] or' _ [] = [] or' p (x:xs) = p x : or' p xs
and' :: Monad m => ( a -> m Bool) -> [a] -> [m Bool] and' _ [] = [] and' p (x:xs) = p x : and' p xs
Note that or' = and' = map.
-Brent
Thanks, Brent for pointing me to this. I guess I got it: With or' = map I get myany :: Monad m => (a -> m Bool) -> [a] -> m Bool myany p = mor . map p and with my former definition of mor I get: myany p = liftM or . sequence . map p and then: myany p = liftM or . mapM p which is Markus solution. -- Manfred