[Haskell-cafe] [ghc] kind of the function arrow

Dominic Orchard dominic.orchard at cl.cam.ac.uk
Thu Jul 2 12:43:33 EDT 2009

I was just playing around and noticed that the kind of the function 
arrow in GHC is (?? -> ? -> *) when I (naively) expected it to be (* -> 
* -> *).
After looking at 
I see that the kind of (->) means that the parameter type cannot be an 
unboxed tuple, whilst the result type can be anything. Why is this?
After reading this documentation I would expect the kind (? -> ? -> *).

I'm now wondering if the kind of (->) could cause problems if the 
following style of declaration is requried:

 > type FunArg a b = (a -> b, a)

*Main> :k FunArg
FunArg :: * -> * -> *

By using type variables, whose default kind is *, the function type is 
fixed to use only boxed types. But if one wanted to allow unboxed type 
parameters the kind would be wrong, and an explicit kind signature of # 
or ? can't be given as they are not part of Haskell's source language.

I guess my question is why the (?? -> ? -> *) kind on (->) and what to 
do if synonyms or data types over (->) are required such as the example 
just stated. I'm just curious.


More information about the Haskell-Cafe mailing list