[Haskell-beginners] Fwd: Re: Multiple letters between -> ->
Francesco Ariis
fa-ml at ariis.it
Sat Nov 25 14:34:47 UTC 2017
On Sat, Nov 25, 2017 at 03:03:26PM +0100, Marcus Manning wrote:
> Ok,
>
> but what is h in:
>
> f :: h a -> ...
>
> is "h" a data constructor or a type constructor or a normal function?
> What is j in
>
> f:: j k l -> ...
>
> and hwat is the difference between j and h?
`h` is a type constructor and `h a` denotes a kind of `* -> *`, hence
λ> :t f
f :: h s -> h s
λ> :t f (Just 8)
f (Just 8) :: Num s => Maybe s
-- because Maybe :: * -> *
λ> :t f Bool
<interactive>:1:3: error:
Data constructor not in scope: Bool :: h s
Similarly, `f :: j k l -> j k l` would only work on kinds
`* -> * -> *` (tuples, etc.) and not on Maybes (* -> *).
More information about the Beginners
mailing list