Unlifted type variables in GHC

Brian Alliet brian at brianweb.net
Thu Dec 7 14:54:18 EST 2006


What kind of problems could crop up if I try to create type variables
with an unlifted kind inside GHC (not in user code, just inside the
compiler)?

I want to make ByteArray# and MutableByteArray# parameterized over
their element types. ByteArray# would have kind # -> #, and
MutableByteArray#, * -> # -> # . indexByteArray# would have the type
(in pseudo haskell) forall (e::#). ByteArray# e -> Int# -> e.

This would put all the ByteArray# operations (along with tagToEnum#) in
that weird class of primops that have a polymorphic type but must be
instantiated with a monomorphic type by the time it hits the code
generator but that shouldn't be a big deal.

Don't get too hung up on the ByteArray# example. I'm not actually
proposing we change ByteArray# (I know it'll cause a few problems with
the current UArray implementation). I'm just wondering if something
like this is possible, and if so, what I should watch out for if I try
to do it.

Thanks,

-Brian


More information about the Glasgow-haskell-users mailing list