Subject: | Re: [Haskell-beginners] Multiple letters between -> -> |
---|---|
Date: | Sat, 25 Nov 2017 13:05:25 +0100 |
From: | Marcus Manning <iconsize@gmail.com> |
To: | Francesco Ariis <fa-ml@ariis.it> |
Sorry, for the long break. Thanks for replying. I do not believe that h is a higher kinded type. What I want to express is that a function f could take a type constructor as argument and simply returns it, but f Maybe throws an Error <interactive>:13:3: error: • Data constructor not in scope: Maybe :: h a • Perhaps you meant variable ‘maybe’ (imported from Prelude) So what instead does h a mean in a function declaration? Cheers, Marcus. On 11/23/2017 06:27 PM, Francesco Ariis wrote: > 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 > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners