| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Binrep.Type.Byte
Description
Safe, if silly, byte representation for use at the type level.
Word8 is a special type that GHC doesn't (and I think can't) promote to the
type level. We only have Naturals, which are unbounded. So we define a safe,
promotable representation, to allow us to prove well-sizedness at compile time.
Then we provide a bunch of type families and reifying typeclasses to enable
going between "similar" kinds (Natural) and types (Word8, ByteString)
respectively.
Type-level functionality is stored in TypeLevel because the
definitions are even sillier than the ones here.
Do not use this on the term level. That would be _extremely_ silly.
Documentation
class ByteVal (n :: Natural) where Source #
Instances
class ByteVals (ns :: [Natural]) where Source #
Efficiently reify a list of type-level Bytes to a bytestring builder.
This is about as far as one should go for pointless performance here, I should think.
class WriteByteVals (ns :: [Natural]) where Source #
Methods
writeByteVals :: Addr# -> IO () Source #
Instances
| WriteByteVals ('[] :: [Natural]) Source # | |
Defined in Binrep.Type.Byte Methods writeByteVals :: Addr# -> IO () Source # | |
| (ByteVal n, WriteByteVals ns) => WriteByteVals (n ': ns) Source # | |
Defined in Binrep.Type.Byte Methods writeByteVals :: Addr# -> IO () Source # | |