[Haskell-beginners] Fwd: Re: Multiple letters between -> ->
Marcus Manning
iconsize at gmail.com
Sat Nov 25 15:19:04 UTC 2017
Ah thanks,
I get confused with instance and declaration level.
But why I can call g with Just:
let g :: h a b -> h a b; g a = a
g Just
but Just is a->Maybe a
On 11/25/2017 03:34 PM, Francesco Ariis wrote:
> 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 (* -> *).
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
More information about the Beginners
mailing list