Copyright  (C) 20132016 University of Twente 2016 Myrtle Software Ltd 

License  BSD2 (see the file LICENSE) 
Maintainer  Christiaan Baaij <christiaan.baaij@gmail.com> 
Safe Haskell  Unsafe 
Language  Haskell2010 
Extensions 

Synopsis
 newtype Unsigned (n :: Nat) = U {}
 size# :: KnownNat n => Unsigned n > Int
 pack# :: Unsigned n > BitVector n
 unpack# :: KnownNat n => BitVector n > Unsigned n
 eq# :: Unsigned n > Unsigned n > Bool
 neq# :: Unsigned n > Unsigned n > Bool
 lt# :: Unsigned n > Unsigned n > Bool
 ge# :: Unsigned n > Unsigned n > Bool
 gt# :: Unsigned n > Unsigned n > Bool
 le# :: Unsigned n > Unsigned n > Bool
 enumFrom# :: KnownNat n => Unsigned n > [Unsigned n]
 enumFromThen# :: KnownNat n => Unsigned n > Unsigned n > [Unsigned n]
 enumFromTo# :: Unsigned n > Unsigned n > [Unsigned n]
 enumFromThenTo# :: Unsigned n > Unsigned n > Unsigned n > [Unsigned n]
 minBound# :: Unsigned n
 maxBound# :: forall n. KnownNat n => Unsigned n
 (+#) :: forall n. KnownNat n => Unsigned n > Unsigned n > Unsigned n
 (#) :: forall n. KnownNat n => Unsigned n > Unsigned n > Unsigned n
 (*#) :: forall n. KnownNat n => Unsigned n > Unsigned n > Unsigned n
 negate# :: forall n. KnownNat n => Unsigned n > Unsigned n
 fromInteger# :: KnownNat n => Integer > Unsigned n
 plus# :: Unsigned m > Unsigned n > Unsigned (Max m n + 1)
 minus# :: forall m n. (KnownNat m, KnownNat n) => Unsigned m > Unsigned n > Unsigned (Max m n + 1)
 times# :: Unsigned m > Unsigned n > Unsigned (m + n)
 quot# :: Unsigned n > Unsigned n > Unsigned n
 rem# :: Unsigned n > Unsigned n > Unsigned n
 toInteger# :: Unsigned n > Integer
 and# :: Unsigned n > Unsigned n > Unsigned n
 or# :: Unsigned n > Unsigned n > Unsigned n
 xor# :: Unsigned n > Unsigned n > Unsigned n
 complement# :: KnownNat n => Unsigned n > Unsigned n
 shiftL# :: KnownNat n => Unsigned n > Int > Unsigned n
 shiftR# :: KnownNat n => Unsigned n > Int > Unsigned n
 rotateL# :: KnownNat n => Unsigned n > Int > Unsigned n
 rotateR# :: KnownNat n => Unsigned n > Int > Unsigned n
 resize# :: forall n m. KnownNat m => Unsigned n > Unsigned m
Datatypes
newtype Unsigned (n :: Nat) Source #
Arbitrarywidth unsigned integer represented by n
bits
Given n
bits, an Unsigned
n
number has a range of: [0 .. 2^n
1]
NB: The Num
operators perform wraparound
on overflow. If you want
saturation on overflow, check out the SaturatingNum
class.
>>>
maxBound :: Unsigned 3
7>>>
minBound :: Unsigned 3
0>>>
read (show (maxBound :: Unsigned 3)) :: Unsigned 3
7>>>
1 + 2 :: Unsigned 3
3>>>
2 + 6 :: Unsigned 3
0>>>
1  3 :: Unsigned 3
6>>>
2 * 3 :: Unsigned 3
6>>>
2 * 4 :: Unsigned 3
0>>>
(2 :: Unsigned 3) `mul` (4 :: Unsigned 3) :: Unsigned 6
8>>>
(2 :: Unsigned 3) `add` (6 :: Unsigned 3) :: Unsigned 4
8>>>
satAdd SatSymmetric 2 6 :: Unsigned 3
7>>>
satSub SatSymmetric 2 3 :: Unsigned 3
0
U  The constructor, 
Instances
Accessors
Length information
Type classes
BitPack
Eq
Ord
Enum (not synthesizable)
Bounded
Num
ExtendingNum
minus# :: forall m n. (KnownNat m, KnownNat n) => Unsigned m > Unsigned n > Unsigned (Max m n + 1) Source #
Integral
toInteger# :: Unsigned n > Integer Source #