Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type family BitRep n :: *
- type IvoryRep a = (IvoryBits a, IvoryOrd a, IvoryInit a, IvoryStore a, IvoryType a, IvoryZeroVal a)
- newtype Bits n = Bits {}
- type Bit = Bits 1
- type family BitSize a :: Nat
- unsafeIntToBits :: (IvoryRep (BitRep n), Integral a) => a -> Bits n
- zeroBits :: IvoryRep (BitRep n) => Bits n
- unsafeRepToBits :: BitRep n -> Bits n
- repToBits :: forall n. (ANat n, IvoryRep (BitRep n)) => BitRep n -> Bits n
- bitsToRep :: Bits n -> BitRep n
Documentation
type family BitRep n :: * Source
Type function: "BitRep (n :: Nat)" returns an Ivory type given a bit size as a type-level natural. Instances of this type family for bits [1..64] are generated using Template Haskell.
type IvoryRep a = (IvoryBits a, IvoryOrd a, IvoryInit a, IvoryStore a, IvoryType a, IvoryZeroVal a) Source
Set of constraints we require on a bit representation type.
A wrapper for an Ivory type that can hold an "n" bit unsigned integer.
IvoryRep (BitRep n) => IvoryExpr (Bits n) Source | |
IvoryRep (BitRep n) => IvoryVar (Bits n) Source | |
IvoryRep (BitRep n) => IvoryType (Bits n) Source | |
IvoryRep (BitRep n) => IvoryEq (Bits n) Source | |
IvoryRep (BitRep n) => IvoryStore (Bits n) Source | |
IvoryRep (BitRep n) => IvoryZeroVal (Bits n) Source | |
IvoryRep (BitRep n) => IvoryInit (Bits n) Source | |
(ANat n, IvoryRep (BitRep n)) => BitData (Bits n) Source | Identity instance of BitData for the base "Bits n" type. |
type BitSize (Bits n) = n Source | |
type BitType (Bits n) = Bits n Source |
unsafeIntToBits :: (IvoryRep (BitRep n), Integral a) => a -> Bits n Source
Convert a Haskell integer to a bit data value without bounds checking. This must not be exported, but is used by the quasiquoter when the values are constant at compile-time and already bounds checked.
unsafeRepToBits :: BitRep n -> Bits n Source