Right now, P.Array supports only lifted types (types of kind *)
ghci> :kind Data.Primitive.Array.Array GHC.Exts.ByteArray#
<interactive>:1:28: error: [GHC-83865]
• Expected a lifted type, but ‘ByteArray#’ is a boxed unlifted type
• In the first argument of ‘Data.Primitive.Array.Array’, namely
‘ByteArray#’
In the type ‘Data.Primitive.Array.Array ByteArray#’
But, in recent GHC versions, the underlying Array# type supports any boxed (lifted or unlifted) type:
The primitive array type should be similarly extended to support this.
It would be very useful, to reduce allocations and indirections (and easily enforce strictness) when using types like ByteArray#. In particular it would support higher level libraries like vector to provide useful Unbox instances for the wrapper types like ByteArray.
Right now,
P.Array
supports only lifted types (types of kind *)But, in recent GHC versions, the underlying
Array#
type supports any boxed (lifted or unlifted) type:The primitive array type should be similarly extended to support this.
It would be very useful, to reduce allocations and indirections (and easily enforce strictness) when using types like
ByteArray#
. In particular it would support higher level libraries likevector
to provide usefulUnbox
instances for the wrapper types likeByteArray
.