ivory-bitdata-0.2.0.0: Ivory bit-data support.

Safe HaskellNone

Ivory.BitData.Monad

Synopsis

Documentation

newtype BitDataM d a Source

An action that modifies a bit data value of type d and returns a a in the Ivory s r monad. Values of this type are passed as the body argument to withBits etc.

Constructors

BitDataM 

Fields

runBitDataM :: State d a
 

Instances

clear :: BitData d => BitDataM d ()Source

Clear the value of the current bit data value.

setBit :: BitData d => BitDataField d Bit -> BitDataM d ()Source

Set a single bit field in the current bit data value.

clearBit :: BitData d => BitDataField d Bit -> BitDataM d ()Source

Clear a single bit.

setField :: (BitData d, BitData b, SafeCast (BitDataRep b) (BitDataRep d)) => BitDataField d b -> b -> BitDataM d ()Source

Set a field to a value.

runBits :: BitData d => BitDataRep d -> BitDataM d a -> (a, BitDataRep d)Source

Execute a bitdata action given an initial value, returning the new bitdata value and the result of the action.

withBits :: BitData d => BitDataRep d -> BitDataM d () -> BitDataRep dSource

Execute a bitdata action given an initial value, returning the new bitdata value.

withBitsRef :: BitData d => Ref s1 (Stored (BitDataRep d)) -> BitDataM d a -> Ivory eff aSource

Execute a bit data action given a reference to a value, writing the resulting value back to the reference upon completion and returning the result of the action.