[Haskell-cafe] (a -> [b]) vs. [a -> b]

Yitzchak Gale gale at sefer.org
Fri Feb 2 04:04:49 EST 2007


Chad Scherrer wrote:
> Are (a -> [b]) and [a -> b] isomorphic? I'm trying to construct a function
>
> f :: (a -> [b]) -> [a -> b]
>
> that is the (at least one-sided) inverse of
>
> f' :: [a -> b] -> a -> [b]
> f' gs x = map ($ x) gs

Anything better than this?

f g = [\x -> g x !! n | n <- [0..]]

-Yitz


More information about the Haskell-Cafe mailing list