[Haskell] Boxing (Day) Question

Niklas Sorensson nik at cs.chalmers.se
Mon Dec 26 08:22:57 EST 2005

> 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.)

That reminds me of something that I have wondered about for some
time. Why is there such reluctance to instantiate polymorhic functions
with the types with which they are used? (This isn't done automatically
in complilers right?)

I can imagine that it is akward to delay code generation until all uses
of a function are known, and that in some cases there may be infinitely
many instances needed. But apart from that, what are the reasons
against this implementation technique?


More information about the Haskell mailing list