Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

The definition of `Aps`

.
Most of this is reexported by ApNormalize.

## Synopsis

- data Aps f a where
- (<$>^) :: (a -> b) -> f a -> Aps f b
- (<*>^) :: Applicative f => Aps f (a -> b) -> f a -> Aps f b
- liftAps :: f a -> Aps f a
- lowerAps :: Applicative f => Aps f a -> f a
- liftA2Aps :: Applicative f => (a -> b -> c) -> f a -> Aps f b -> Aps f c
- apsToApDList :: Applicative f => Aps f a -> ApDList f a

# Normalizing applicative functors

An applicative functor transformer which accumulates `f`

-actions (things of type `f x`

)
in a normal form.

It constructs a value of type `f a`

with the following syntactic invariant.
It depends on the number of `f`

-actions `a1 ... an`

composing it,
which are delimited using `liftAps`

:

- Zero action:
`pure x`

- One action:
`f <$> a1`

- Two or more actions:
`liftA2 f a1 a2 <*> a3 <*> ... <*> an`

Pure :: a -> Aps f a | |

FmapLift :: (x -> a) -> f x -> Aps f a | |

LiftA2Aps :: (x -> y -> z -> a) -> f x -> f y -> ApDList f z -> Aps f a |

#### Instances

Functor (Aps f) Source # | |

Applicative f => Applicative (Aps f) Source # | |

(<$>^) :: (a -> b) -> f a -> Aps f b infixl 4 Source #

`f <$>^ u :: Aps f b`

is a delayed representation of `f <$> u :: f b`

,
so that it can be fused with other applicative operations.

`f <$>^ u`

is a shorthand for `f <$> `

.`liftAps`

u

liftA2Aps :: Applicative f => (a -> b -> c) -> f a -> Aps f b -> Aps f c Source #

Append an action to the left of an `Aps`

.

apsToApDList :: Applicative f => Aps f a -> ApDList f a Source #