Copyright | (C) 2013-2016 University of Twente |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Extensions | MagicHash |
Bit
Bit
Bounded Bit Source # | |
Enum Bit Source # | |
Eq Bit Source # | |
Integral Bit Source # | |
Data Bit Source # | |
Num Bit Source # | |
Ord Bit Source # | |
Real Bit Source # | |
Show Bit Source # | |
Lift Bit Source # | |
Bits Bit Source # | |
FiniteBits Bit Source # | |
Default Bit Source # | |
NFData Bit Source # | |
ShowX Bit Source # | |
BitPack Bit Source # | |
Bundle Bit Source # | |
type BitSize Bit Source # | |
type Unbundled domain Bit Source # | |
Construction
Initialisation
BitVector
data BitVector (n :: Nat) Source #
A vector of bits.
- Bit indices are descending
Num
instance performs unsigned arithmetic.
Accessors
Length information
Construction
bLit :: KnownNat n => String -> Q (TExp (BitVector n)) Source #
Create a binary literal
>>>
$$(bLit "1001") :: BitVector 4
1001>>>
$$(bLit "1001") :: BitVector 3
001
NB: You can also just write:
>>>
0b1001 :: BitVector 4
1001
The advantage of bLit
is that you can use computations to create the
string literal:
>>>
import qualified Data.List as List
>>>
$$(bLit (List.replicate 4 '1')) :: BitVector 4
1111