[Haskell-cafe] (a -> [b]) -> [a -> b] ?
mail at joachim-breitner.de
Mon Dec 4 14:00:23 EST 2006
while pondering over the four fours problem, I wondered: Is there a
function of type
(a -> [b]) -> [a -> b]
It looks a bit like sequence when applied in the ((->) a) Monad:
sequence :: [a -> b] -> a -> [b]
but I was looking for the other direction.
I came up with:
\g -> map (\n a -> g a !! n) [1..]
which has the desired type and functionality, but it looks rather
inelegant and messy. Any better ideas?
Joachim "nomeata" Breitner
mail: mail at joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
JID: joachimbreitner at amessage.de | http://www.joachim-breitner.de/
Debian Developer: nomeata at debian.org
More information about the Haskell-Cafe