squares-0.1: The double category of Hask functors and profunctors

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.Square

Description

 
Synopsis

Documentation

return :: Monad m => Square '[] '[] '[] '[m] Source #

+-----+
|     |
|  R  |
|  v  |
+--m--+

bind :: Monad m => Square '[Star m] '[] '[m] '[m] Source #

+--m--+
|  v  |
m>-B  |
|  v  |
+--m--+

`(>>=)` as a square (or to be precise its flipped version `(=<<)`)

Left identity law:

+-----+
|  R  |     +-----+
|  v  |     |     |
m>-B  | === m>-\  |
|  v  |     |  v  |
+--m--+     +--m--+

Right identity law:

+---m-+
| R v |     +--m--+
| v | |     |  |  |
| \-B | === |  v  |
|   v |     |  |  |
+---m-+     +--m--+

Associativity law:

+--m--+     +---m-+
|  v  |     m>\ v |
m>-B  |     | v | |
|  v  | === m>B | |
m>-B  |     | \-B |
|  v  |     |   v |
+--m--+     +---m-+

join :: Monad m => Square '[] '[] '[m, m] '[m] Source #

+-m-m-+
| v v |
| \-@ |
|   v |
+---m-+
join = toRight ||| bind

(>=>) :: Monad m => Square '[Star m, Star m] '[Star m] '[] '[] Source #

+-----+
m>-\  |
m>-@  |
|  \->m
+-----+

Kleisli composition `(M.>=>)`

(>=>) = fromLeft === bind === toRight