Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides (linear) Kleisli and CoKleisli arrows
This module is meant to be imported qualified, perhaps as below.
import qualified Data.Profunctor.Kleisli as Linear
What are Kleisli arrows?
The basic idea is that a Kleisli arrow is like a function arrow
and Kleisli m a b
is similar to a function from a
to b
. Basically:
type Kleisli m a b = a %1-> m b
Why make this definition?
It let's us view Kleisli m
for a certain m
as a certain kind of
function arrow, give it instances, abstract over it an so on.
For instance, if m
is any functor, Kleisli m
is a Profunctor
.
CoKleisli
A CoKleisli arrow is just one that represents a computation from
a m a
to an a
via a linear arrow. (It's a Co-something because it
reverses the order of the function arrows in the something.)
Synopsis
- newtype Kleisli m a b = Kleisli {
- runKleisli :: a %1 -> m b
- newtype CoKleisli w a b = CoKleisli {
- runCoKleisli :: w a %1 -> b
Documentation
newtype Kleisli m a b Source #
Linear Kleisli arrows for the monad m
. These arrows are still useful
in the case where m
is not a monad however, and some profunctorial
properties still hold in this weaker setting.
Kleisli | |
|
Instances
Functor f => Monoidal Either Void (Kleisli f) Source # | |
Applicative f => Monoidal (,) () (Kleisli f) Source # | |
Applicative f => Strong Either Void (Kleisli f) Source # | |
Functor f => Strong (,) () (Kleisli f) Source # | |
Functor f => Profunctor (Kleisli f) Source # | |
Applicative f => Wandering (Kleisli f) Source # | |
Defined in Data.Profunctor.Kleisli.Linear |
newtype CoKleisli w a b Source #
Linear co-Kleisli arrows for the comonad w
. These arrows are still
useful in the case where w
is not a comonad however, and some
profunctorial properties still hold in this weaker setting.
However stronger requirements on f
are needed for profunctorial
strength, so we have fewer instances.
CoKleisli | |
|