[Haskell-cafe] [ghc] kind of the function arrow
wren ng thornton
wren at freegeek.org
Thu Jul 2 20:43:00 EDT 2009
Dominic Orchard wrote:
> 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 (? -> ? -> *).
Unboxed tuples don't exist. That is, they are in evidence, but they
don't actually have any physical representation.
The elements of an unboxed tuple are stored in registers when returning
from a function, so that the caller can access them immediately (rather
than needing to indirect through a pointer to a tuple). ISTR that
because of this strategy, there are restrictions on what types of tuples
can be unboxed. Theoretically GHC could also allow passing certain
arguments in registers when invoking a function, but this isn't
supported as yet.
More information about the Haskell-Cafe