[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:20:52 EST 2007
At the risk of seeming terribly naive, I'm going to go ahead and share
my intuition.
Would not any function of type (forall a. a -> b) be a constant
function in b? If the function is allowed no inspection of its
argument, it must not depend on its argument.
The same intuition could be applied to the codomain. The type (forall
a. m a -> m b) would tell me that this function is not allowed to
inspect the carrier of its input type. I would need to know more about
the type variable m in order to suggest what this function could do.
E.G. if m were required to be a functor, then the function could be:
theFun :: Functor m => (forall a. a -> b) -> (forall a. m a -> m b)
theFun f m_a = fmap f m_a
Is this the sort of pondering you were after? Gurus: did I miss something?
On 2/27/07, Jacques Carette <carette at mcmaster.ca> 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
> _______________________________________________
> 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