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
Instances
Bounded Bit Source # | |
Enum Bit Source # | |
Eq Bit Source # | |
Integral Bit Source # | |
Data Bit Source # | |
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bit -> c Bit # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Bit # dataTypeOf :: Bit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Bit) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Bit) # gmapT :: (forall b. Data b => b -> b) -> Bit -> Bit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bit -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bit -> r # gmapQ :: (forall d. Data d => d -> u) -> Bit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Bit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bit -> m Bit # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bit -> m Bit # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bit -> m Bit # | |
Num Bit Source # | |
Ord Bit Source # | |
Real Bit Source # | |
toRational :: Bit -> Rational # | |
Show Bit Source # | |
Lift Bit Source # | |
Bits Bit Source # | |
FiniteBits Bit Source # | |
NFData Bit Source # | |
ShowX Bit Source # | |
Default 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.
Instances
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