No, I did not. Looks like it's exactly what I was looking for! I
implemented the first two:
1. 8 possible values, organized into 6 constructors:
```
data ALU = Add Bool | Sub Bool | And | XOr | Or | BCD
deriving (Eq, Ord, Show, Generic, NFDataX, Lift)
{-# ANN module (DataReprAnn
$(liftQ [t|ALU|])
3
[ ConstrRepr 'Add 0b110 0b000 [0b001]
, ConstrRepr 'Sub 0b110 0b010 [0b001]
, ConstrRepr 'And 0b111 0b100 []
, ConstrRepr 'XOr 0b111 0b101 []
, ConstrRepr 'Or 0b111 0b110 []
, ConstrRepr 'BCD 0b111 0b111 []
]) #-}
```
2. `Wedge A B`, where `A` has 3 values, and `B` 4:
```
data InAddr
= FromPtr
| FromPort
| IncrPC
| IncrSP
deriving (Show, Eq, Ord, Enum, Bounded, Generic, NFDataX, Lift)
data OutAddr
= ToPtr
| ToPort
| DecrSP
deriving (Show, Eq, Ord, Enum, Bounded, Generic, NFDataX, Lift)
{-# ANN module (DataReprAnn
$(liftQ [t|Wedge OutAddr InAddr|])
3
[ ConstrRepr 'Here 0b100 0b000 [0b011]
, ConstrRepr 'There 0b100 0b100 [0b011]
, ConstrRepr 'Nowhere 0b111 0b011 []
]) #-}
```
3. `Maybe (Index 548)`
Now this one is trickier... I tried the following, to no avail:
```
type MicroSize = $(microSize)
type MicroPtr = Index MicroSize
{-# ANN module (DataReprAnn
$(liftQ [t|Maybe MicroPtr|])
10
[ ConstrRepr 'Nothing 0b1111111111 0b1111111111 []
, ConstrRepr 'Just 0b0000000000 0b0000000000 [0b1111111111]
]) #-}
```
I don't get any error messages, but in the generated Verilog code, I can
see that `Maybe MicroPtr` is still stored as 11 bits; for example, `Just
257` is `{1'b1,10'd257}`.