ivory-0.1.0.7: Safe embedded C programming.

Safe HaskellNone
LanguageHaskell2010

Ivory.Language.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

Instances

Monad (BitDataM d) Source # 

Methods

(>>=) :: BitDataM d a -> (a -> BitDataM d b) -> BitDataM d b #

(>>) :: BitDataM d a -> BitDataM d b -> BitDataM d b #

return :: a -> BitDataM d a #

fail :: String -> BitDataM d a #

Functor (BitDataM d) Source # 

Methods

fmap :: (a -> b) -> BitDataM d a -> BitDataM d b #

(<$) :: a -> BitDataM d b -> BitDataM d a #

Applicative (BitDataM d) Source # 

Methods

pure :: a -> BitDataM d a #

(<*>) :: BitDataM d (a -> b) -> BitDataM d a -> BitDataM d b #

(*>) :: BitDataM d a -> BitDataM d b -> BitDataM d b #

(<*) :: BitDataM d a -> BitDataM d b -> BitDataM d a #

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, [String]) 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 d Source #

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 a Source #

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.