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

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

Data.Traversable.Square

Description

 
Synopsis

Documentation

traverse :: (Traversable t, Applicative f) => Square '[Star f] '[Star f] '[t] '[t] Source #

+--t--+
|  v  |
f>-T->f
|  v  |
+--t--+

traverse as a square.

Naturality law:

+-----t--+     +--t-----+
|     v  |     |  v     |
f>-@->T->g === f>-T->@->g
|     v  |     |  v     |
+-----t--+     +--t-----+

Identity law:

+--t--+     +--t--+
|  v  |     |  |  |
|  T  | === |  v  |
|  v  |     |  |  |
+--t--+     +--t--+

Composition law:

+--t--+     +--t--+
|  v  |     |  v  |
f>-T->f     f>\|/>f
|  v  | === |  T  |
g>-T->g     g>/|\>g
|  v  |     |  v  |
+--t--+     +--t--+
traverse = (fromLeft ||| funId) === sequence === (funId ||| toRight)

sequence :: (Traversable t, Applicative f) => Square '[] '[] '[f, t] '[t, f] Source #

+-f-t---+
| v v   |
| \-@-\ |
|   v v |
+---t-f-+
sequence = toRight ||| traverse ||| fromLeft

mapAccumL :: Traversable t => Square '[Biff (->) ((,) s) ((,) s)] '[Biff (->) ((,) s) ((,) s)] '[t] '[t] Source #

mapAccumL :: ((s, a) -> (s, b)) -> (s, t a) -> (s, t b)

mapAccumR :: Traversable t => Square '[Biff (->) ((,) s) ((,) s)] '[Biff (->) ((,) s) ((,) s)] '[t] '[t] Source #

mapAccumR :: ((s, a) -> (s, b)) -> (s, t a) -> (s, t b)