[Haskell-cafe] What inhabits this type: (forall a. a -> b) -> (forall a. m a -> m b)

Bryan Burgers bryan.burgers at gmail.com
Tue Feb 27 18:33:41 EST 2007

> Since my last query was answered so quickly, let's try another.
> I have looked on Hoogle.  I would have asked Djinn, but I don't have it
> around.  So, can someone find a term that inhabits
> (forall a. a -> b) -> (forall a. m a -> m b)
> ?  I think of this as the type of functions that, given a function from
> any boxed-up a to a b, will give me a function from a boxed-up ma to a m
> b -- m does not have to be a Monad!.
> Jacques

(Jacques, sorry you got this twice--I forgot to send it to the list.)

How about this one?
f g x = return $ g x

Since 'g' can, by definition, take any type and return a 'b', then it
should be able to take some 'm a' and return something of type 'b',
which we just return.

I'm not really familiar with foralls, but the two explicit foralls
make the two a's different, right?

(After reading the other responses, I must be wrong, but can somebody
explain why?)

Bryan Burgers

More information about the Haskell-Cafe mailing list