[Haskell-cafe] What inhabits this type: (forall a. a -> b) ->
(forall a. m a -> m b)
Nicolas Frisby
nicolas.frisby at gmail.com
Tue Feb 27 18:57:54 EST 2007
The type doesn't actually indicate that the type m supports a return
operation. I introduced the qualifier that it was a functor. You
implicity introduced the constraint that it is a monad (actually a
"pointed functor", but that's a Monad's return operator). With that
constraint, your thought process seems fine to me.
On 2/27/07, Bryan Burgers <bryan.burgers at gmail.com> wrote:
> > 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list