[Haskell-cafe] (a -> [b]) -> [a -> b] ?
nicolas.frisby at gmail.com
Mon Dec 4 14:12:29 EST 2006
It seems there's an assumption about the range of the parameter
function and the range of the entire function. That is, I think we're
assuming that the length of the final result is the same as the length
of the result of the first function?
If I'm correct in presuming that constraint, then I think this
indicates that a "more elegant" solution might involve using the
lightweight-dependently-typed vectors approach. Though I can't promise
it will actually be nicer!
On 12/4/06, Joachim Breitner <mail at joachim-breitner.de> wrote:
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe