19 Jun
2003
19 Jun
'03
4:05 p.m.
Derek Elkins wrote:
flist :: [a->b] -> a -> [b] flist fs a = map (flip ($) a) fs
or much nicer (IMO) flist fs a = map ($ a) fs
This is a case where I'd prefer a list comprehension: flist fs a = [ f a | f <- fs ] (and this could be a monad comprehension, if Haskell still had them...)
the generalized solution being simply, f mf x = do f <- mf return (f x)
Or just replace map by fmap in your flist from above. All the best Christian Sievers