air-2015.5.4: air

Safe HaskellNone
LanguageHaskell98

Air.Data.Record.SimpleLabel

Contents

Synopsis

Getter, setter and modifier types.

type Getter s x = s -> x Source

type Setter s x = x -> s -> s Source

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

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 :-> x Source

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

Get the getter function from a label.

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

Get the setter function from a label.

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

Get the modifier function from a label.

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

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 () infixr 7 Source

Alias for setM that reads like an assignment.