{-# LANGUAGE DataKinds #-}
module Control.Monad.Square where
import Prelude hiding (return)
import Data.Square
import Data.Profunctor
import qualified Control.Monad as M
return :: Monad m => Square '[] '[] '[] '[m]
return :: forall (m :: * -> *). Monad m => Square '[] '[] '[] '[m]
return = forall (ps :: [* -> * -> *]) (qs :: [* -> * -> *]) (fs :: [* -> *])
(gs :: [* -> *]).
(IsPList ps, IsPList qs, IsFList fs, IsFList gs,
Profunctor (PList qs)) =>
(forall a b.
PlainP ps a b -> PlainP qs (PlainF fs a) (PlainF gs b))
-> Square ps qs fs gs
mkSquare (forall (m :: * -> *) a. Monad m => a -> m a
M.return forall b c a. (b -> c) -> (a -> b) -> a -> c
.)
bind :: Monad m => Square '[Star m] '[] '[m] '[m]
bind :: forall (m :: * -> *). Monad m => Square '[Star m] '[] '[m] '[m]
bind = forall (ps :: [* -> * -> *]) (qs :: [* -> * -> *]) (fs :: [* -> *])
(gs :: [* -> *]).
(IsPList ps, IsPList qs, IsFList fs, IsFList gs,
Profunctor (PList qs)) =>
(forall a b.
PlainP ps a b -> PlainP qs (PlainF fs a) (PlainF gs b))
-> Square ps qs fs gs
mkSquare (forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
(=<<) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall {k} (f :: k -> *) d (c :: k). Star f d c -> d -> f c
runStar)
join :: Monad m => Square '[] '[] '[m, m] '[m]
join :: forall (m :: * -> *). Monad m => Square '[] '[] '[m, m] '[m]
join = forall (f :: * -> *). Functor f => Square '[] '[Star f] '[f] '[]
toRight forall (rs :: [* -> * -> *]) (fs :: [* -> *]) (gs :: [* -> *])
(hs :: [* -> *]) (is :: [* -> *]) (ps :: [* -> * -> *])
(qs :: [* -> * -> *]).
(Profunctor (PList rs), IsFList fs, IsFList gs, Functor (FList hs),
Functor (FList is)) =>
Square ps qs fs gs
-> Square qs rs hs is -> Square ps rs (fs ++ hs) (gs ++ is)
||| forall (m :: * -> *). Monad m => Square '[Star m] '[] '[m] '[m]
bind
(>=>) :: Monad m => Square '[Star m, Star m] '[Star m] '[] '[]
>=> :: forall (m :: * -> *).
Monad m =>
Square '[Star m, Star m] '[Star m] '[] '[]
(>=>) = forall (f :: * -> *). Square '[Star f] '[] '[] '[f]
fromLeft forall (ps :: [* -> * -> *]) (qs :: [* -> * -> *])
(ss :: [* -> * -> *]) (fs :: [* -> *]) (gs :: [* -> *])
(rs :: [* -> * -> *]) (hs :: [* -> *]).
(IsPList ps, IsPList qs, Profunctor (PList qs),
Profunctor (PList ss)) =>
Square ps qs fs gs
-> Square rs ss gs hs -> Square (ps ++ rs) (qs ++ ss) fs hs
=== forall (m :: * -> *). Monad m => Square '[Star m] '[] '[m] '[m]
bind forall (ps :: [* -> * -> *]) (qs :: [* -> * -> *])
(ss :: [* -> * -> *]) (fs :: [* -> *]) (gs :: [* -> *])
(rs :: [* -> * -> *]) (hs :: [* -> *]).
(IsPList ps, IsPList qs, Profunctor (PList qs),
Profunctor (PList ss)) =>
Square ps qs fs gs
-> Square rs ss gs hs -> Square (ps ++ rs) (qs ++ ss) fs hs
=== forall (f :: * -> *). Functor f => Square '[] '[Star f] '[f] '[]
toRight