Skip to content

{-# UNPACK #-} support for size-indexed types

I don't know too much of the theory, but it seems to me that {-# UNPACK #-} should be able to work for something like this:

data Tup (l::[*]) where
    Nil  :: HList '[]
    Cons :: e -> {-# UNPACK #-} !(HList l) -> HList (e ': l)

This is essentially just HList from the HList package but strict in the second Cons argument. What I would want is for Tup '[a,b,c] to be represented in just the same way as (a,b,c). When possible, I'd want the getters/setters/lenses to be optimized to index into the unpacked structure rather than walking along it.

Trac metadata
Trac field Value
Version 7.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information