[Haskell-cafe] Re: [Haskell] Re: Boxing (Day) Question

Ashley Yakeley ashley at semantic.org
Wed Jan 4 04:22:56 EST 2006

In article 
<036EAC76E7F5EC4996A3B3C3657D41160416A761 at EUR-MSG-21.europe.corp.microso
 "Simon Peyton-Jones" <simonpj at microsoft.com> wrote:

> You'd still need several versions of the code for a polymorphic function, one 
> for pointer values, one for 4-byte non-pointers, one for 8-byte non-pointers 
> etc.

Yes, but that's up to the user. A type variable always has a particular 
kind, so for instance one might want an array over any 4-byte 
non-pointer value:

  data Array4 (a :: #4)

Functions on Array4 only need one version of code. This makes 
polymorphism less useful, of course, but the goal here is to be closer 
to the machine.

Trouble comes when you try to aggregate, however; one would need kinds 
that represent 8-byte values consisting of four bytes of data and four 
bytes of pointer, and so on.

Ashley Yakeley, Seattle WA

More information about the Haskell-Cafe mailing list