Wrapping unlifted datatypes without pointer indirection?!
Say you have an unlifted datatype U
type U :: UnliftedType
data U = U1 | U2 <params> | ...
For better ergonomics, typeclass instances, etc., you also want a lifted wrapper L
data L = L U
Unfortunately it seems that this wrapper would incur an additional pointer indirection, somewhat reducing the benefits of using an unlifted type in the first place.
Is there a way that GHC could provide such lifted wrappers but without incurring a pointer indirection?!
(Background: In unordered-containers
we're considering using UnliftedDatatypes
for HashMap
: https://github.com/haskell-unordered-containers/unordered-containers/issues/463)