
28 Nov
2009
28 Nov
'09
5:55 p.m.
You can pattern match on the right hand side of '|' in a list comprehension, since a list comprehension is just the list monad. add :: Int -> Int -> Int add x y = x + y -- a list of partially applied functions adds = [add 3, add 5, add 7, add 3, add 5, add 8] -- an example usage of the list kP num = map (\ f -> f 10 ) (addPs num) -- add3s = filter (?) adds -- add3s = [add 3, add 3] -- addEvens = filter (?) adds --addEvens = [add 8] addPs num = [ x | x <- adds, x 0 == num ] -- Regards, Casey