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
(http://hackage.haskell.org/packages/archive/ghc/6.10.2/doc/html/Type.html#5)
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.
--
Live well,
~wren
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe