air-2011.6.19: air

Air.Data.Record.SimpleLabel

Contents

Synopsis

Getter, setter and modifier types.

type Getter s x = s -> xSource

type Setter s x = x -> s -> sSource

type Modifier s x = (x -> x) -> s -> sSource

Label type.

data Point s x Source

newtype s :-> x Source

Constructors

Label (Point s x) 

Instances

label :: Getter s x -> Setter s x -> s :-> xSource

get :: (s :-> x) -> s -> xSource

Get the getter function from a label.

set :: (s :-> x) -> x -> s -> sSource

Get the setter function from a label.

mod :: (s :-> x) -> (x -> x) -> s -> sSource

Get the modifier function from a label.

getM :: MonadState s m => (s :-> b) -> m bSource

Get a value out of state pointed to by the specified label.

setM :: MonadState s m => (s :-> b) -> b -> m ()Source

Set a value somewhere in state pointed to by the specified label.

modM :: MonadState s m => (s :-> b) -> (b -> b) -> m ()Source

Modify a value with a function somewhere in state pointed to by the specified label.

(=:) :: MonadState s m => (s :-> b) -> b -> m ()Source

Alias for setM that reads like an assignment.

Derive labels using Template Haskell.