Ashley Yakeley wrote:
In article <[EMAIL PROTECTED]>,
 Lennart Augustsson <[EMAIL PROTECTED]> wrote:


On the whole it looks like you want type variables with kind #.
There are very good implementation reasons for not allowing this.
If you had type variables of kind # you could have polymorphic
functions over unboxed values.  But since the values are unboxed
they don't have a uniform representation (e.g., a Double# is probably
twice the size of a Float#).  So polymorphic functions over unboxed
values are not easy to implement.  (You can imagine implementations
of them, but none of them are pleasent.)


Oh, I hadn't thought of that.

One solution might be to have a kind for each kind of storage:

  * for boxed values
  #4 for 4-byte values
  #8 for 8-byte values
  #P for pointers to things that need to be GC'd (or whatever)
  etc.

Do you think this would work?

Yes, I think it would work.  But I'd think it would be awkward.
Now you need to know the size of each unboxed type to make polymorphic
functions (and that's not even portable).

        -- Lennart

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to