!|jwT      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS BSD-style (see the file LICENSE)sjoerd@w3future.comSafe-.HUV squaresType level list append BSD-style (see the file LICENSE)sjoerd@w3future.comSafe &'.=>?HUVsquaresCombining and splitting nested s.squares!N-ary composition of profunctors.     BSD-style (see the file LICENSE)sjoerd@w3future.comSafe &'.=>?HSUVX squaresONatural transformations between two functors. (Why is this still not in base??)squaresCombining and splitting nested s.squaresN-ary composition of functors. 0FList '[] a ~ a FList '[f, g, h] a ~ h (g (f a))   BSD-style (see the file LICENSE)sjoerd@w3future.comSafe &'-.>HSUVXRx!squares+Values as a functor from the unit category.#squares4The boring profunctor from and to the unit category.%squares E1--a--H | v | U--@--q 1 = Hask^0 = (), H = Hask | v | 1--b--H&squares Uncurry the kind of a bifunctor. 3type UncurryF :: (a -> b -> Type) -> (a, b) -> Type)squaresBCombine two profunctors from Hask to a profunctor from Hask x Hask+squares FH-f--H | v | p--@--q H = Hask, H = Hask x Hask | v | H-g--H,squaresTo make composing squares associative, this library uses squares with lists of functors and profunctors, which are composed together. tFList '[] a ~ a FList '[f, g, h] a ~ h (g (f a)) PList '[] a b ~ a -> b PList '[p, q, r] a b ~ (p a x, q x y, r y b)-squares '+--f--+ | v | p--@--q | v | +--g--+ "forall a b. p a b -> q (f a) (g b)The complete definition of a square is a combination of natural transformations between functors and natural transformations between profunctors.GTo make type inferencing easier the above type is wrapped by a newtype.0squares '+-----+ | | | | | | +-----+  forall a b. (a -> b) -> (a -> b)0The empty square is the identity transformation.1squares '+-----+ | | p-----p | | +-----+ forall a b. p a b -> p a b*Profunctors are drawn as horizontal lines. Note that 0 is 1 for the profunctor (->). We don't draw a line for (->)7 because it is the identity for profunctor composition.2squares '+--f--+ | | | | v | | | | +--f--+ $forall a b. (a -> b) -> (f a -> f b)_Functors are drawn with vertical lines with arrow heads. You will recognize the above type as T!aWe don't draw lines for the identity functor, because it is the identity for functor composition.3squares '+--f--+ | | | | @ | | | | +--g--+ $forall a b. (a -> b) -> (f a -> g b)/Non-identity transformations are drawn with an @] in the middle. Natural transformations between haskell functors are usualy given the type forall a. f a -> g a. The type above you get when THping before or after. (It doesn't matter which, because of naturality!)4squares '+-----+ | | p--@--q | | +-----+ forall a b. p a b -> q a b,Natural transformations between profunctors.5squares1A helper function to add the wrappers needed for  and M, if the square has exactly one (pro)functor on each side (which is common).6squares +--f--+ +--h--+ +--f--h--+ | v | | v | | v v | p--@--q ||| q--@--r ==> p--@--@--r | v | | v | | v v | +--g--+ +--i--+ +--g--i--+#Horizontal composition of squares. 1_ is the identity of `(|||)`. This is regular function composition of the underlying functions.7squares +--f--+ | v | p--@--q +--f--+ | v | | v | +--g--+ p--@--q === ==> | v | +--g--+ r--@--s | v | | v | r--@--s +--h--+ | v | +--h--+!Vertical composition of squares. 2 is the identity of `(===)`.8squares '+--f--+ | v | | \->f | | +-----+ A functor f3 can be bent to the right to become the profunctor U f.9squares '+--f--+ | v | f<-/ | | | +-----+ A functor f2 can be bent to the left to become the profunctor V f.:squares '+-----+ | | | /-<f | v | +--f--+The profunctor V f( can be bent down to become the functor f again.;squares '+-----+ | | f>-\ | | v | +--f--+The profunctor U f( can be bent down to become the functor f again.<squares S+-----+ f>-\ | fromLeft | v | === f<-/ | toLeft +-----+; and 9$ can be composed vertically to bend U f back to V f.=squares U+-----+ | /-<f fromRight | v | === | \->f toRight +-----+: and 8$ can be composed vertically to bend V f to U f.>squares +f-f-f+ +--f--+ spiderLemma n = |v v v| f> v <f fromLeft ||| funId ||| fromRight | \|/ | | \|/ | === p--@--q ==> p--@--q n | /|\ | | /|\ | === |v v v| g< v >g toLeft ||| funId ||| toRight +g-g-g+ +--g--+eThe spider lemma is an example how bending wires can also be seen as sliding functors around corners.?squares \spiderLemma' n = (toRight === proId === fromRight) ||| n ||| (toLeft === proId === fromLeft)(The spider lemma in the other direction.6squares7squares>squares?squares!"#$%&'()*+,-./0123456789:;<=>?01234-./,56789:;<=>?+)*&'(%#$!"6675 BSD-style (see the file LICENSE)sjoerd@w3future.comSafe.]@squares '+--t--+ | v | f>-T->f | v | +--t--+@ as a square.Naturality law: +-----t--+ +--t-----+ | v | | v | f>-@->T->g === f>-T->@->g | v | | v | +-----t--+ +--t-----+ Identity law: c+--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--+Asquares 1+-f-t---+ | v v | | \-@-\ | | v v | +---t-f-+ ,sequence = toRight ||| traverse ||| fromLeft@A@A BSD-style (see the file LICENSE)sjoerd@w3future.comSafe&'.eLBsquares '+-a"_-+ | v | p--@--p | v | +-a"_-+Csquares '+-a"_-+ | v | p--@--p | v | +-a"_-+Dsquares '+-a!_-+ | v | p--@--p | v | +-a!_-+Esquares '+--f--+ | v | p--@--p | v | +--f--+Fsquares , +-----+ | | (!)-@ | | | +-----+Gsquares (+-----+ | | | @-(!) | | +-----+Hsquares , +-----+ | /-p q.p-@ | | \-q +-----+Isquares - +-----+ p-\ | | @-q.p q-/ | +-----+BCDEFGHIBCDEFGHI BSD-style (see the file LICENSE)sjoerd@w3future.comSafe.qJsquares '+-----+ | | | R->m | | +-----+Ksquares '+--m--+ | v | m>-B | | v | +--m--+`(>>=)`Left identity law: w+-------+ | R>-\ + +-----+ | v | | | m>---B | === m>-\ | | v | | v | +----m--+ +--m--+Right identity law: m+----m--+ +--m--+ | v | | | | | R>-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--+Lsquares '+-m-m-+ | v v | | \-@ | | v | +---m-+ join = toRight ||| bindMsquares '+-----+ m>-\ | m>-@ | | \->m +-----+Kleisli composition `(M.>=>)`JKLMJKLM BSD-style (see the file LICENSE)sjoerd@w3future.comSafe&'.wlNsquares '+-----+ | | | @--a | | +-----+Osquares '+-----+ a--\ | | @--a a--/ | +-----+Psquares '+-_"d-+ | v | a--@--a | v | +-_"d-+Qsquares 'H-"--H | v | a-@--a | v | H-"--HRsquares '+-_"d-+ | v | a--@--a | v | +-_"d-+Ssquares 'H-"--H | v | a-@--a | v | H-"--HNOPQRSNOPQRSW      !"#$%&'()**++,--.//01213456789:;<=>?@ABCDEFGHIJKLMNOPQRSFTGUVWXYZ[YZ\]$squares-0.0.1-3u4N5jmRIHr13YSRkZxIG3Data.Type.List Data.Profunctor.Composition.ListData.Functor.Compose.List Data.SquareData.Traversable.SquareData.Profunctor.SquareControl.Monad.SquareControl.Arrow.Square++PAppendpappend punappendPListHomPPCompunHomunP$fProfunctorPList$fProfunctorPList0$fProfunctorPList1 $fPAppend: $fPAppend:0 $fPAppend[]~>FAppendfappend funappendFListIdFFCompunIdunFunFComp$fFunctorFList$fFunctorFList0$fFunctorFList1 $fFAppend: $fFAppend:0 $fFAppend[]ValueFUnitSquare01UncurryFcurryF:**:Square21SquareSquareNTunSquare emptySquareproIdfunIdfunNatproNatmkSquare|||===toRighttoLeft fromRightfromLeftuLeftuRight spiderLemma spiderLemma'traversesequencesecondrightclosedmapfromHomtoHomfromProcompose toProcomposereturnbindjoinkleisliarr>>>***+++baseGHC.Basefmap(profunctors-5.5.2-KC2L325It2EIdUumqsPs2KData.Profunctor.TypesStarCostar