Multiple letters between -> ->

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple letters between -> ->

Marcus Manning
Hi,

Original I thought a Signature like:

f :: h a -> h a

means that h is a higher kinded type just like in Type Classes ( for
instance f in Functor f).

But I heard such a meaning is not allowed in normal Haskell functions.
What instead is the meaning of h a?

Cheers,

Marcus.

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Multiple letters between -> ->

Francesco Ariis
On Thu, Nov 23, 2017 at 06:19:51PM +0100, Marcus Manning wrote:

> Hi,
>
> Original I thought a Signature like:
>
> f :: h a -> h a
>
> means that h is a higher kinded type just like in Type Classes ( for
> instance f in Functor f).
>
> But I heard such a meaning is not allowed in normal Haskell functions. What
> instead is the meaning of h a?

Hello Marcus,
    you can write that but, since we know nothing about `h` and `a`,
the only possible (non-undefined) function to implement that
signature is:

    f :: h a -> h a
    f = id

Any other implementation would require us to know something about h,
hence a typeclass-constraint (e.g. Functor h =>) on h.
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners