Field combinators.

- idL :: a :-> a
- (#) :: (Field a, Field b, Dst a ~ Src b) => a -> b -> Src a :-> Dst b
- (#$) :: Field a => a -> (Dst a -> b) -> Src a :-> b
- (<.#>) :: (Functor f, Field a) => f (Src a) -> a -> f (Dst a)
- (<#>) :: (Applicative f, Field a, Field b, Dst a ~ f (Src b)) => a -> b -> Src a :-> f (Dst b)
- (<##>) :: (Monad m, Field a, Field b, Dst a ~ m (Src b), Dst b ~ m c) => a -> b -> Src a :-> m c
- (*#) :: Field b => [Src b] -> [b] -> [Dst b]
- (=*) :: Field a => a -> [Dst a] -> [Src a :-> Src a]
- (<=:) :: (MonadState (Src a) m, Field a) => a -> Dst a -> m ()
- (<=~) :: (MonadState (Src a) m, Field a) => a -> (Dst a -> Dst a) -> m ()
- onField :: Field a => (Dst a -> Dst a -> t) -> a -> Src a -> Src a -> t

# Basic combinators.

(#) :: (Field a, Field b, Dst a ~ Src b) => a -> b -> Src a :-> Dst bSource

Field composition with arguments in OO-like order.

(#$) :: Field a => a -> (Dst a -> b) -> Src a :-> bSource

Compose fields with ordinary functions. As functions are one-way, the resulting field cannot be used to set values.

# Combinators for `Functor`

s, `Applicative`

s and

`Functor`

`Applicative`

(<.#>) :: (Functor f, Field a) => f (Src a) -> a -> f (Dst a)Source

Infix

for fields.
`fmap`

Examples:

persons <.#> firstName

do (v1, v2) <- takeMVar mv <.#> (field1, field2) putStrLn . unlines $ [ "v1: " ++ show v1, "v2: " ++ show v2 ]

(<#>) :: (Applicative f, Field a, Field b, Dst a ~ f (Src b)) => a -> b -> Src a :-> f (Dst b)Source

functor composition for fields.
`Applicative`

book .# characters <#> lastName

(<##>) :: (Monad m, Field a, Field b, Dst a ~ m (Src b), Dst b ~ m c) => a -> b -> Src a :-> m cSource

Flattening monadic composition for fields.

person .# superior <##> superior <##> superior <##> superior

# Zippy assignment.

(*#) :: Field b => [Src b] -> [b] -> [Dst b]Source

Zippy field reference to be used with `(`

.
`=*`

)

[ rec1, rec2 ] *# field =* [ value1, value2 ]

(=*) :: Field a => a -> [Dst a] -> [Src a :-> Src a]Source

Zippy infix assignment to be used with `(`

.
`*#`

)

# Assignment and modification in a State monad.

(<=:) :: (MonadState (Src a) m, Field a) => a -> Dst a -> m ()Source

Infix assignment for the State monad.

(field1, field2) <=: (value1, value2)

(<=~) :: (MonadState (Src a) m, Field a) => a -> (Dst a -> Dst a) -> m ()Source

Infix modification for the State monad.

(field1, field2) <=~ (f, g)