Copyright | © Edward Kmett 2010-2015 © Eric Mertens 2014 Johan Kiviniemi 2013 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Bits
is an arbitrary length natural number type
- newtype Bit1 = Bit1 Bit
- data Bit2 = Bit2 !Bit !Bit
- data Bit3 = Bit3 !Bit !Bit !Bit
- data Bit4 = Bit4 !Bit !Bit !Bit !Bit
- data Bit5 = Bit5 !Bit !Bit !Bit !Bit !Bit
- data Bit6 = Bit6 !Bit !Bit !Bit !Bit !Bit !Bit
- data Bit7 = Bit7 !Bit !Bit !Bit !Bit !Bit !Bit !Bit
- data Bit8 = Bit8 !Bit !Bit !Bit !Bit !Bit !Bit !Bit !Bit
- newtype Bits = Bits [Bit]
- class HasBits a where
- isEven :: HasBits b => b -> Bit
- isOdd :: HasBits b => b -> Bit
- sumBit :: Foldable t => t Bit -> Bits
- sumBits :: (Foldable t, HasBits a) => t a -> Bits
- fullAdder :: Bit -> Bit -> Bit -> (Bit, Bit)
- halfAdder :: Bit -> Bit -> (Bit, Bit)
Fixed length bit vectors
Variable length bit vectors
sumBits :: (Foldable t, HasBits a) => t a -> Bits Source #
Compute the sum of a source of Bits
values.
Adders
Compute the sum and carry bit from adding three bits.