Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Crypto.Math.Bits
Synopsis
- data FBits (n :: Nat) = FBits {}
- data FBitsK = FBitsK (forall n. (KnownNat n, SizeValid n) => FBits n)
- type SizeValid n = (KnownNat n, 1 <= n)
- splitHalf :: forall m n. (SizeValid n, (n * 2) ~ m) => FBits m -> (FBits n, FBits n)
- append :: forall m n r. (SizeValid m, SizeValid n, SizeValid r, (m + n) ~ r) => FBits n -> FBits m -> FBits r
- dropBitsOnRight :: forall a b diff. (KnownNat diff, b <= a, SizeValid a, SizeValid b, (a - b) ~ diff) => FBits a -> FBits b
- dropBitsOnLeft :: forall a b. (KnownNat b, b <= a, SizeValid a, SizeValid b) => FBits a -> FBits b
Documentation
data FBits (n :: Nat) Source #
Finite Bits
Sadly Bits is taken by Bits operation
Instances
append :: forall m n r. (SizeValid m, SizeValid n, SizeValid r, (m + n) ~ r) => FBits n -> FBits m -> FBits r Source #
Append 2 FBits together where the left member is shifted to make room for the right element.
e.g. append (0x1 :: FBits 1) (0x70 :: FBits 7) = 0xf0 :: FBits 8