[Haskell-beginners] Multiple letters between -> ->

Francesco Ariis fa-ml at ariis.it
Thu Nov 23 17:27:15 UTC 2017


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.


More information about the Beginners mailing list