… Monads, Profunctors, Categories, Applicatives, and everything else.

Manuel Bärenz

`Stream a -> Stream b`

subtype hierarchy:

`a -> b`

(via`fmap`

)`a -> Stream b`

(via e.g.`head`

)- Synchronous stream functions (
`SF`

) - Arbitrary functions
`Stream a -> Stream b`

But we can also precompose with functions! (A.k.a `Contravariant`

.)

- Every functor
`f`

gives several canonical profunctors:`a -> f b`

(Kleisli)`f a -> b`

(Cokleisli, irrelevant today)`f a -> f b`

- Instances are all cobbled together with
`(.)`

and`fmap`

. - But there are profunctors that are not of this form!

- Every
`Profunctor`

gives you back a`Functor`

..- …by fixing the “input” type
- Just use
`rmap`

- But you cannot always recover the
`Profunctor`

from that! - Example:
`SF`

In the `Functor`

-`Applicative`

-`Monad`

-hierarchy, people sometimes insert `Arrow`

.

`arr`

and`(>>>)`

generalise`lmap`

and`rmap`

.

- Every monad
`m`

gives several canonical arrows:`a -> m b`

(Kleisli)`m a -> b`

(Cokleisli, irrelevant today)`m a -> m b`

- Instances are all cobbled together with
`(.)`

and`fmap`

. - But there are arrows that are not of this form!

- Every
`Arrow`

gives you back an`Applicative`

…- …by fixing the “input” type
- Just use (
`&&&)`

- But you cannot always recover the
`Arrow`

from that! - Example:
`SF`