Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This structure is part of the definition of Aps
.
Synopsis
- newtype ApDList f a = ApDList (forall r. Yoneda f (a -> r) -> f r)
- liftApDList :: Applicative f => f a -> ApDList f a
- lowerApDList :: Yoneda f (b -> c) -> ApDList f b -> f c
- newtype Yoneda f a = Yoneda (forall x. (a -> x) -> f x)
Applicative difference lists
Type of applicative difference lists.
An applicative transformer which accumulates f
-actions in
a left-nested composition using (
.<*>
)
ApDList
represents a sequence of f
-actions
u1 :: f x1
, ... un :: f xn
as "term with a hole"
(_ <*> u1 <*> ... <*> un) :: f r
.
That hole must have type _ :: f (x1 -> ... -> un -> r)
;
the variable number of arrows is hidden by existential quantification
and continuation passing.
To help ensure that syntactic invariant,
the Functor
and Applicative
instances for ApDList
have no constraints.
liftApDList
is the only function whose signature requires an
constraint, wrapping each action Applicative
fu
inside one (
.<*>
)
liftApDList :: Applicative f => f a -> ApDList f a Source #
A difference list with one element u
, denoted _ <*> u
.
lowerApDList :: Yoneda f (b -> c) -> ApDList f b -> f c Source #
Complete a difference list, filling the hole with the first argument.