UP | HOME

Kleisli Arrows

An arrow suggests and implies a direction. It is a symbol for the universal notion of a single step (of a process) or a individual completed transformation.

Here a and b are of the same level of abstraction (usually a Set)

a -> b

Here it crosses an abstraction boundary or a resulting value is of a different kind of abstraction.

a -> m b

This notion is, in turn, has been generalized as

pure :: a -> f a

which captures a general notion of placing into.

or even more generally

return :: a -> m a

And then we have a couple of convectional hacks to apply these abstract entities to each other or compose them.

type Applicative :: (* -> *) -> Constraint
class Functor f => Applicative f where
  ...
type Monad :: (* -> *) -> Constraint
class Applicative m => Monad m where
  ...

Notice the arrows (kinds).

Cheaters

We cheat and could “extract” values from different contexts (except IO), while we actually shouldn’t.

The reason is that causality has a direction and cannot be reversed, just like IO, by the way.

When something became something else it is irreversible, at least at the level of Molecular biology or Life Itself (yes, I know, inside a star…)

Author: <schiptsov@gmail.com>

Email: lngnmn2@yahoo.com

Created: 2023-08-08 Tue 18:39

Emacs 29.1.50 (Org mode 9.7-pre)