ap-normalize-0.1.0.1: Self-normalizing applicative expressions

ApNormalize.Aps

Description

The definition of Aps. Most of this is reexported by ApNormalize.

Synopsis

# Normalizing applicative functors

data Aps f a where Source #

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 Constructors  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 Instances details  Functor (Aps f) Source # Instance detailsDefined in ApNormalize.Aps Methodsfmap :: (a -> b) -> Aps f a -> Aps f b #(<$) :: a -> Aps f b -> Aps f a # Applicative f => Applicative (Aps f) Source # Instance detailsDefined in ApNormalize.Aps Methodspure :: a -> Aps f a #(<*>) :: Aps f (a -> b) -> Aps f a -> Aps f b #liftA2 :: (a -> b -> c) -> Aps f a -> Aps f b -> Aps f c #(*>) :: Aps f a -> Aps f b -> Aps f b #(<*) :: Aps f a -> Aps f b -> Aps f a #

(<$>^) :: (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.

(<*>^) :: Applicative f => Aps f (a -> b) -> f a -> Aps f b infixl 4 Source #

u <*>^ v appends an f-action v to the right of an (Aps f)-action u.

u <*>^ v is a shorthand for u <*> liftAps v.

liftAps :: f a -> Aps f a Source #

Lift an f-action into Aps f.

lowerAps :: Applicative f => Aps f a -> f a Source #

Lower an f-action from Aps f.

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 #

Conversion from Aps to ApDList.