On 06/06/07, Steffen Mazanek <[EMAIL PROTECTED]> wrote:
Hello,
is there a function f::[a->b]->a->[b] in the libraries? Couldn't find one
using
hoogle although this seems to be quite a common thing...
Possibly it's just too small to bother putting in a separate function.
let fs = [ (*2), (+2), (2-) ]
:t fs
fs :: [Integer -> Integer]
map ($5) fs
[10,7,-3]
:t map ($5)
map ($5) :: (Num a) => [a -> b] -> [b]
let g = \x -> map ($x)
:t g
g :: a -> [a -> b] -> [b]
That's essentially what you want, but we could go the extra distance.
:t flip g
flip g :: [a -> b] -> a -> [b]
let h = flip g
h fs (5)
[10,7,-3]
f fs i = map ($i) fs
D.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe