packages feed

deepcontrol 0.3.2.0 → 0.3.3.0

raw patch · 10 files changed

+523/−133 lines, 10 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- DeepControl.Commutative: instance DeepControl.Commutative.Commutative ((,) a)
- DeepControl.Commutative: instance DeepControl.Commutative.Commutative (Control.Applicative.Const m)
- DeepControl.Monad.Trans.Writer: WriterT2 :: m1 (m2 (a, w)) -> WriterT2 w m1 m2 a
- DeepControl.Monad.Trans.Writer: WriterT3 :: m1 (m2 (m3 (a, w))) -> WriterT3 w m1 m2 m3 a
- DeepControl.Monad.Trans.Writer: [runWriterT2] :: WriterT2 w m1 m2 a -> m1 (m2 (a, w))
- DeepControl.Monad.Trans.Writer: [runWriterT3] :: WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 (a, w)))
- DeepControl.Monad.Trans.Writer: execWriterT2 :: (Monad m1, Monad2 m2) => WriterT2 w m1 m2 a -> m1 (m2 w)
- DeepControl.Monad.Trans.Writer: execWriterT3 :: (Monad m1, Monad2 m2, Monad3 m3) => WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 w))
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Functor (DeepControl.Monad.Trans.Writer.WriterT2 w m1 m2)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Functor (DeepControl.Monad.Trans.Writer.WriterT3 w m1 m2 m3)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Trans.Writer.WriterT2 w m1 m2)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Trans.Writer.WriterT3 w m1 m2 m3)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Trans.Writer.WriterT2 w m1 m2)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Applicative (DeepControl.Monad.Trans.Writer.WriterT2 w m1 m2)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Monad (DeepControl.Monad.Trans.Writer.WriterT2 w m1 m2)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Trans.Writer.WriterT3 w m1 m2 m3)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Applicative (DeepControl.Monad.Trans.Writer.WriterT3 w m1 m2 m3)
- DeepControl.Monad.Trans.Writer: instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Monad (DeepControl.Monad.Trans.Writer.WriterT3 w m1 m2 m3)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTrans2 (DeepControl.Monad.Trans.Writer.WriterT2 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTrans2Down (DeepControl.Monad.Trans.Writer.WriterT2 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTrans3 (DeepControl.Monad.Trans.Writer.WriterT3 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTrans3Down (DeepControl.Monad.Trans.Writer.WriterT3 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransCover (Control.Monad.Trans.Writer.Lazy.WriterT w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransCover2 (DeepControl.Monad.Trans.Writer.WriterT2 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransCover3 (DeepControl.Monad.Trans.Writer.WriterT3 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransDown (Control.Monad.Trans.Writer.Lazy.WriterT w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransFold2 (DeepControl.Monad.Trans.Writer.WriterT2 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTransFold3 (DeepControl.Monad.Trans.Writer.WriterT3 w)
- DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Monad.Trans.MonadTrans_ (Control.Monad.Trans.Writer.Lazy.WriterT w)
- DeepControl.Monad.Trans.Writer: mapWriterT2 :: (m1 (m2 (a, w)) -> n1 (n2 (b, w'))) -> WriterT2 w m1 m2 a -> WriterT2 w' n1 n2 b
- DeepControl.Monad.Trans.Writer: mapWriterT3 :: (m1 (m2 (m3 (a, w))) -> n1 (n2 (n3 (b, w')))) -> WriterT3 w m1 m2 m3 a -> WriterT3 w' n1 n2 n3 b
- DeepControl.Monad.Trans.Writer: newtype WriterT2 w m1 m2 a
- DeepControl.Monad.Trans.Writer: newtype WriterT3 w m1 m2 m3 a
+ DeepControl.Commutative: float2 :: (Applicative m1, Commutative m2, Commutative m3) => m2 (m3 (m1 a)) -> m1 (m2 (m3 a))
+ DeepControl.Commutative: float3 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4) => m2 (m3 (m4 (m1 a))) -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Commutative: float4 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => m2 (m3 (m4 (m5 (m1 a)))) -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Commutative: float5 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Commutative m6) => m2 (m3 (m4 (m5 (m6 (m1 a))))) -> m1 (m2 (m3 (m4 (m5 (m6 a)))))
+ DeepControl.Commutative: sink2 :: (Commutative m1, Commutative m2, Applicative m3) => m1 (m2 (m3 a)) -> m2 (m3 (m1 a))
+ DeepControl.Commutative: sink3 :: (Commutative m1, Commutative m2, Commutative m3, Applicative m4) => m1 (m2 (m3 (m4 a))) -> m2 (m3 (m4 (m1 a)))
+ DeepControl.Commutative: sink4 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Applicative m5) => m1 (m2 (m3 (m4 (m5 a)))) -> m2 (m3 (m4 (m5 (m1 a))))
+ DeepControl.Commutative: sink5 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Applicative m6) => m1 (m2 (m3 (m4 (m5 (m6 a))))) -> m2 (m3 (m4 (m5 (m6 (m1 a)))))
+ DeepControl.Monad.Signatures: type CallCC2 m1 m2 a b = ((a -> m1 (m2 b)) -> m1 (m2 a)) -> m1 (m2 a)
+ DeepControl.Monad.Signatures: type CallCC3 m1 m2 m3 a b = ((a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))
+ DeepControl.Monad.Signatures: type CallCC4 m1 m2 m3 m4 a b = ((a -> m1 (m2 (m3 (m4 b)))) -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Monad.Signatures: type CallCC5 m1 m2 m3 m4 m5 a b = ((a -> m1 (m2 (m3 (m4 (m5 b))))) -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Monad.Signatures: type Catch2 e m1 m2 a = m1 (m2 a) -> (e -> m1 (m2 a)) -> m1 (m2 a)
+ DeepControl.Monad.Signatures: type Catch3 e m1 m2 m3 a = m1 (m2 (m3 a)) -> (e -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))
+ DeepControl.Monad.Signatures: type Catch4 e m1 m2 m3 m4 a = m1 (m2 (m3 (m4 a))) -> (e -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Monad.Signatures: type Catch5 e m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 a)))) -> (e -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Monad.Signatures: type Listen2 w m1 m2 a = m1 (m2 a) -> m1 (m2 (a, w))
+ DeepControl.Monad.Signatures: type Listen3 w m1 m2 m3 a = m1 (m2 (m3 a)) -> m1 (m2 (m3 (a, w)))
+ DeepControl.Monad.Signatures: type Listen4 w m1 m2 m3 m4 a = m1 (m2 (m3 (m4 a))) -> m1 (m2 (m3 (m4 (a, w))))
+ DeepControl.Monad.Signatures: type Listen5 w m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 a)))) -> m1 (m2 (m3 (m4 (m5 (a, w)))))
+ DeepControl.Monad.Signatures: type Pass2 w m1 m2 a = m1 (m2 (a, w -> w)) -> m1 (m2 a)
+ DeepControl.Monad.Signatures: type Pass3 w m1 m2 m3 a = m1 (m2 (m3 (a, w -> w))) -> m1 (m2 (m3 a))
+ DeepControl.Monad.Signatures: type Pass4 w m1 m2 m3 m4 a = m1 (m2 (m3 (m4 (a, w -> w)))) -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Monad.Signatures: type Pass5 w m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 (a, w -> w))))) -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Monad.Trans.Except: catchError2 :: (MonadError e m2, Commutative m1, Commutative m2) => m1 (m2 a) -> (e -> m1 (m2 a)) -> m1 (m2 a)
+ DeepControl.Monad.Trans.Except: catchError3 :: (MonadError e m3, Commutative m1, Commutative m2, Commutative m3) => m1 (m2 (m3 a)) -> (e -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))
+ DeepControl.Monad.Trans.Except: catchError4 :: (MonadError e m4, Commutative m1, Commutative m2, Commutative m3, Commutative m4) => m1 (m2 (m3 (m4 a))) -> (e -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Monad.Trans.Except: catchError5 :: (MonadError e m5, Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => m1 (m2 (m3 (m4 (m5 a)))) -> (e -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Monad.Trans.Except: throwError2 :: (MonadError e m2, Applicative m1) => e -> m1 (m2 a)
+ DeepControl.Monad.Trans.Except: throwError3 :: (MonadError e m3, Applicative m1, Applicative m2) => e -> m1 (m2 (m3 a))
+ DeepControl.Monad.Trans.Except: throwError4 :: (MonadError e m4, Applicative m1, Applicative m2, Applicative m3) => e -> m1 (m2 (m3 (m4 a)))
+ DeepControl.Monad.Trans.Except: throwError5 :: (MonadError e m5, Applicative m1, Applicative m2, Applicative m3, Applicative m4) => e -> m1 (m2 (m3 (m4 (m5 a))))
+ DeepControl.Monad.Trans.RWS: instance (GHC.Base.Monoid w, GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Alternative (DeepControl.Monad.Trans.RWS.RWST2 r w s m1 m2)
+ DeepControl.Monad.Trans.RWS: instance (GHC.Base.Monoid w, GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.RWS.RWST2 r w s m1 m2)
+ DeepControl.Monad.Trans.RWS: instance (GHC.Base.Monoid w, GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.MonadPlus m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Alternative (DeepControl.Monad.Trans.RWS.RWST3 r w s m1 m2 m3)
+ DeepControl.Monad.Trans.RWS: instance (GHC.Base.Monoid w, GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.MonadPlus m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.RWS.RWST3 r w s m1 m2 m3)
+ DeepControl.Monad.Trans.RWS: liftCatch2 :: Catch2 e m1 m2 (a, s, w) -> Catch e (RWST2 r w s m1 m2) a
+ DeepControl.Monad.Trans.RWS: liftCatch3 :: Catch3 e m1 m2 m3 (a, s, w) -> Catch e (RWST3 r w s m1 m2 m3) a
+ DeepControl.Monad.Trans.Reader: instance (GHC.Base.Alternative m1, GHC.Base.Alternative m2, GHC.Base.Alternative m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Alternative (DeepControl.Monad.Trans.Reader.ReaderT3 r m1 m2 m3)
+ DeepControl.Monad.Trans.Reader: instance (GHC.Base.Alternative m1, GHC.Base.Alternative m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Alternative (DeepControl.Monad.Trans.Reader.ReaderT2 r m1 m2)
+ DeepControl.Monad.Trans.Reader: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.Reader.ReaderT2 r m1 m2)
+ DeepControl.Monad.Trans.Reader: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.MonadPlus m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.Reader.ReaderT3 r m1 m2 m3)
+ DeepControl.Monad.Trans.Reader: liftCatch2 :: Catch2 e m1 m2 a -> Catch e (ReaderT2 r m1 m2) a
+ DeepControl.Monad.Trans.Reader: liftCatch3 :: Catch3 e m1 m2 m3 a -> Catch e (ReaderT3 r m1 m2 m3) a
+ DeepControl.Monad.Trans.State: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Alternative (DeepControl.Monad.Trans.State.StateT2 s m1 m2)
+ DeepControl.Monad.Trans.State: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.State.StateT2 s m1 m2)
+ DeepControl.Monad.Trans.State: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.MonadPlus m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Alternative (DeepControl.Monad.Trans.State.StateT3 s m1 m2 m3)
+ DeepControl.Monad.Trans.State: instance (GHC.Base.MonadPlus m1, GHC.Base.MonadPlus m2, GHC.Base.MonadPlus m3, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.MonadPlus (DeepControl.Monad.Trans.State.StateT3 s m1 m2 m3)
+ DeepControl.Monad.Trans.State: liftCatch2 :: Catch2 e m1 m2 (a, s) -> Catch e (StateT2 s m1 m2) a
+ DeepControl.Monad.Trans.State: liftCatch3 :: Catch3 e m1 m2 m3 (a, s) -> Catch e (StateT3 s m1 m2 m3) a
+ DeepControl.Monad.Trans.State: liftListen2 :: (Monad m1, Monad2 m2) => Listen2 w m1 m2 (a, s) -> Listen w (StateT2 s m1 m2) a
+ DeepControl.Monad.Trans.State: liftListen3 :: (Monad m1, Monad2 m2, Monad3 m3) => Listen3 w m1 m2 m3 (a, s) -> Listen w (StateT3 s m1 m2 m3) a
+ DeepControl.Monad.Trans.State: liftPass2 :: (Monad m1, Monad2 m2) => Pass2 w m1 m2 (a, s) -> Pass w (StateT2 s m1 m2) a
+ DeepControl.Monad.Trans.State: liftPass3 :: (Monad m1, Monad2 m2, Monad3 m3) => Pass3 w m1 m2 m3 (a, s) -> Pass w (StateT3 s m1 m2 m3) a
+ DeepControl.Monad.Trans.Writer: instance GHC.Base.Monoid w => DeepControl.Commutative.Commutative (Control.Monad.Trans.Writer.Lazy.Writer w)
+ DeepControl.Monad.Trans.Writer: listen2 :: (MonadWriter w m2, Applicative m1) => m1 (m2 a) -> m1 (m2 (a, w))
+ DeepControl.Monad.Trans.Writer: listen3 :: (MonadWriter w m3, Applicative m1, Applicative m2) => m1 (m2 (m3 a)) -> m1 (m2 (m3 (a, w)))
+ DeepControl.Monad.Trans.Writer: pass2 :: (MonadWriter w m2, Applicative m1) => m1 (m2 (a, w -> w)) -> m1 (m2 a)
+ DeepControl.Monad.Trans.Writer: pass3 :: (MonadWriter w m3, Applicative m1, Applicative m2) => m1 (m2 (m3 (a, w -> w))) -> m1 (m2 (m3 a))
- DeepControl.Commutative: class (Functor c) => Commutative c
+ DeepControl.Commutative: class (Applicative c) => Commutative c

Files

DeepControl/Commutative.hs view
@@ -13,24 +13,40 @@  -} module DeepControl.Commutative (-    -- * The 'Commutative' class+    -- * Level-1+    -- ** The 'Commutative' class     Commutative(..),-    -- * Utility functions+    -- ** Utility functions     cmap,     cfor,-    -- * General definitions for superclass methods+    -- ** General definitions for superclass methods     fmapDefault,     foldMapDefault,++    -- * Level-2+    sink2, float2,++    -- * Level-3+    sink3, float3,++    -- * Level-4+    sink4, float4,++    -- * Level-5+    sink5, float5,+     ) where   import DeepControl.Applicative +import Data.Monoid+ --------------------------------------------------------------------------------- Commutative+-- Level-1  -- |  -- -class (Functor c) => Commutative c where+class (Applicative c) => Commutative c where   -- | This method is equivalent for @'Data.Traversable.sequenceA'@ just except the name.   --   The only difference is the name "commute", that is to say from which no action kind of concepts smell.   commute :: Applicative f => c (f a) -> f (c a)@@ -53,12 +69,6 @@     commute (Right x) = Right |$> x     commute (Left x)  = (*:) $ Left x -instance Commutative ((,) a) where-    commute (x, y) = x <|(,)|$> y--instance Commutative (Const m) where-    commute (Const m) = (*:) $ Const m- {- instance Commutative ((->) r) where     -- TODO: If GHC could parse this expression, maybe I could write up DeepControl.Monad.@@ -84,5 +94,48 @@     pure = Id     Id f <*> Id x = Id (f x) +------------------------------------------------------------------------------+-- Level-2++sink2 :: (Commutative m1, Commutative m2, Applicative m3) => +         m1 (m2 (m3 a)) -> m2 (m3 (m1 a))+sink2 = (commute|$>) . commute++float2 :: (Applicative m1, Commutative m2, Commutative m3) => +          m2 (m3 (m1 a)) -> m1 (m2 (m3 a))+float2 = commute . (commute|$>)++------------------------------------------------------------------------------+-- Level-3++sink3 :: (Commutative m1, Commutative m2, Commutative m3, Applicative m4) => +         m1 (m2 (m3 (m4 a))) -> m2 (m3 (m4 (m1 a)))+sink3 = (sink2|$>) . commute++float3 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4) => +          m2 (m3 (m4 (m1 a))) -> m1 (m2 (m3 (m4 a)))+float3 = commute . (float2|$>)++------------------------------------------------------------------------------+-- Level-4++sink4 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Applicative m5) => +         m1 (m2 (m3 (m4 (m5 a)))) -> m2 (m3 (m4 (m5 (m1 a))))+sink4 = (sink3|$>) . commute++float4 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => +          m2 (m3 (m4 (m5 (m1 a)))) -> m1 (m2 (m3 (m4 (m5 a))))+float4 = commute . (float3|$>)++------------------------------------------------------------------------------+-- Level-5++sink5 :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Applicative m6) => +         m1 (m2 (m3 (m4 (m5 (m6 a))))) -> m2 (m3 (m4 (m5 (m6 (m1 a)))))+sink5 = (sink4|$>) . commute++float5 :: (Applicative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Commutative m6) => +          m2 (m3 (m4 (m5 (m6 (m1 a))))) -> m1 (m2 (m3 (m4 (m5 (m6 a)))))+float5 = commute . (float4|$>)  
+ DeepControl/Monad/Signatures.hs view
@@ -0,0 +1,79 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  DeepControl.Monad.Signatures+-- Copyright   :  (c) Ross Paterson 2012,+--                (c) 2015 KONISHI Yohsuke+-- License     :  BSD-style (see the file LICENSE)+--+-- Maintainer  :  KONISHI Yohsuke+-- Stability   :  experimental+-- Portability :  portable+--+-- Signatures for monad operations that require specialized lifting.+-- Each signature has a uniformity property that the lifting should satisfy.+-----------------------------------------------------------------------------++module DeepControl.Monad.Signatures (+    -- * Level-1+    module Control.Monad.Signatures,++    -- * Level-2+    CallCC2, Catch2, Listen2, Pass2,++    -- * Level-3+    CallCC3, Catch3, Listen3, Pass3,++    -- * Level-4+    CallCC4, Catch4, Listen4, Pass4,++    -- * Level-5+    CallCC5, Catch5, Listen5, Pass5,++  ) where++import Control.Monad.Signatures++-------------------------------------------------------------------------+-- Level-2++type CallCC2 m1 m2 a b = ((a -> m1 (m2 b)) -> m1 (m2 a)) -> m1 (m2 a)++type Catch2 e m1 m2 a = m1 (m2 a) -> (e -> m1 (m2 a)) -> m1 (m2 a)++type Listen2 w m1 m2 a = m1 (m2 a) -> m1 (m2 (a, w))++type Pass2 w m1 m2 a = m1 (m2 (a, w -> w)) -> m1 (m2 a)++-------------------------------------------------------------------------+-- Level-3++type CallCC3 m1 m2 m3 a b = ((a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))++type Catch3 e m1 m2 m3 a = m1 (m2 (m3 a)) -> (e -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))++type Listen3 w m1 m2 m3 a = m1 (m2 (m3 a)) -> m1 (m2 (m3 (a, w)))++type Pass3 w m1 m2 m3 a = m1 (m2 (m3 (a, w -> w))) -> m1 (m2 (m3 a))++-------------------------------------------------------------------------+-- Level-4++type CallCC4 m1 m2 m3 m4 a b = ((a -> m1 (m2 (m3 (m4 b)))) -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))++type Catch4 e m1 m2 m3 m4 a = m1 (m2 (m3 (m4 a))) -> (e -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))++type Listen4 w m1 m2 m3 m4 a = m1 (m2 (m3 (m4 a))) -> m1 (m2 (m3 (m4 (a, w))))++type Pass4 w m1 m2 m3 m4 a = m1 (m2 (m3 (m4 (a, w -> w)))) -> m1 (m2 (m3 (m4 a)))++-------------------------------------------------------------------------+-- Level-5++type CallCC5 m1 m2 m3 m4 m5 a b = ((a -> m1 (m2 (m3 (m4 (m5 b))))) -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))++type Catch5 e m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 a)))) -> (e -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))++type Listen5 w m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 a)))) -> m1 (m2 (m3 (m4 (m5 (a, w)))))++type Pass5 w m1 m2 m3 m4 m5 a = m1 (m2 (m3 (m4 (m5 (a, w -> w))))) -> m1 (m2 (m3 (m4 (m5 a))))+
DeepControl/Monad/Trans.hs view
@@ -27,7 +27,7 @@     -- ** Level-1     MonadTrans(..),      MonadTransDown(..), M,-    -- *** cover functions +    -- *** cover       MonadTransCover(..),     -- *** other       MonadTrans_(..), @@ -35,9 +35,9 @@     -- ** Level-2     MonadTrans2(..),      MonadTrans2Down(..), M_, T_, -    -- *** fold functions+    -- *** fold      MonadTransFold2(..), -    -- *** cover functions +    -- *** cover       MonadTransCover2(..),     (|**|),     -- *** other  @@ -46,9 +46,9 @@     -- ** Level-3     MonadTrans3(..),      MonadTrans3Down(..), M__, T__, -    -- *** fold functions+    -- *** fold      MonadTransFold3(..), -    -- *** cover functions+    -- *** cover      MonadTransCover3(..),     (|***|), (|-**|), (|*-*|), (|**-|),     -- *** other  @@ -305,17 +305,17 @@ >-- Tock! >-- ((),1) >->save    :: StateT Int (Writer [Int]) ()+>save :: StateT Int (Writer [Int]) () >save = do >    n <- get >    lift $ tell [n] >->program ::                   StateT2 Int IO (Writer [Int]) ()+>program ::               StateT2 Int IO (Writer [Int]) () >program = replicateM_ 4 $ do >    (|-*|) tock->        :: (Monad2     m) => StateT2 Int IO m              ()+>        :: (Monad2 m) => StateT2 Int IO m              () >    (|*-|) save->        :: (Monad      m) => StateT2 Int m  (Writer [Int]) ()+>        :: (Monad  m) => StateT2 Int m  (Writer [Int]) () > >-- λ> execWriter |$> runStateT2 program 0 >-- Tock!
DeepControl/Monad/Trans/Except.hs view
@@ -8,30 +8,45 @@ Stability   : experimental Portability : --- -This module extended RWS Monad in mtl(monad-transformer-library).+This module extended RWS Monad of mtl(monad-transformer-library). -}-{-# LANGUAGE -        DeriveFunctor,-        GeneralizedNewtypeDeriving,-        FlexibleInstances,-        FunctionalDependencies- #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE RankNTypes #-} module DeepControl.Monad.Trans.Except (+    -- * Level-1     module Control.Monad.Except, +    -- * Level-2+    throwError2,+    catchError2,++    -- * Level-3+    throwError3,+    catchError3,++    -- * Level-4+    throwError4,+    catchError4,++    -- * Level-5+    throwError5,+    catchError5,+     ) where   import DeepControl.Applicative import DeepControl.Monad--- import DeepControl.Monad.Trans import DeepControl.Commutative  import Control.Monad.Except import Control.Monad.Identity  -------------------------------------------------------------------+-- Level-1 +instance Commutative (Except e) where+    commute x = ExceptT . Identity |$> commute (runExcept $ x)+ instance Monad2 (Except e) where     m >>== f = (ExceptT . Identity |$>) $ (runExcept |$> m) >>== runExcept |$>> f instance Monad3 (Except e) where@@ -41,6 +56,87 @@ instance Monad5 (Except e) where     m >>>>>== f = (ExceptT . Identity |$>>>>) $ (runExcept |$>>>> m) >>>>>== runExcept |$>>>>> f -instance Commutative (Except e) where-    commute x = ExceptT . Identity |$> commute (runExcept $ x)+----------------------------------------------------------------+-- Level-2 +throwError2 :: (MonadError e m2, Applicative m1) => e -> m1 (m2 a)+throwError2 = (*:) |$> throwError++catchError2 :: (MonadError e m2, Commutative m1, Commutative m2) => +                m1 (m2 a) -> (e -> m1 (m2 a)) -> m1 (m2 a)+catchError2 = coverCatch catchError+  where+    coverCatch :: (Commutative m1, Commutative m2) => +                  (forall a. m2 a -> (e -> m2 a) -> m2 a) -> +                   m1 (m2 a) -> (e -> m1 (m2 a)) -> m1 (m2 a)+    coverCatch catch m h = +        let m' = commute m+            h' = commute |$> h+        in commute $ catch m' h'++----------------------------------------------------------------+-- Level-3++throwError3 :: (MonadError e m3, Applicative m1, Applicative m2) => e -> m1 (m2 (m3 a))+throwError3 = (**:) |$> throwError++catchError3 :: (MonadError e m3, Commutative m1, Commutative m2, Commutative m3) => +                m1 (m2 (m3 a)) -> (e -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))+catchError3 = cover2Catch catchError+  where+    cover2Catch :: (Commutative m1, Commutative m2, Commutative m3) => +                   (forall a. m3 a -> (e -> m3 a) -> m3 a) -> +                    m1 (m2 (m3 a)) -> (e -> m1 (m2 (m3 a))) -> m1 (m2 (m3 a))+    cover2Catch catch m h = +        let m' = float2 m+            h' = float2 |$> h+        in sink2 $ catch m' h'++----------------------------------------------------------------+-- Level-4++throwError4 :: (MonadError e m4, Applicative m1, Applicative m2, Applicative m3) => e -> m1 (m2 (m3 (m4 a)))+throwError4 = (***:) |$> throwError++catchError4 :: (MonadError e m4, Commutative m1, Commutative m2, Commutative m3, Commutative m4) => +                m1 (m2 (m3 (m4 a))) -> (e -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))+catchError4 = cover3Catch catchError+  where+    cover3Catch :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4) => +                   (forall a. m4 a -> (e -> m4 a) -> m4 a) -> +                    m1 (m2 (m3 (m4 a))) -> (e -> m1 (m2 (m3 (m4 a)))) -> m1 (m2 (m3 (m4 a)))+    cover3Catch catch m h = +        let m' = float3 m+            h' = float3 |$> h+        in sink3 $ catch m' h'++----------------------------------------------------------------+-- Level-5++throwError5 :: (MonadError e m5, Applicative m1, Applicative m2, Applicative m3, Applicative m4) => e -> m1 (m2 (m3 (m4 (m5 a))))+throwError5 = (****:) |$> throwError++catchError5 :: (MonadError e m5, Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => +                m1 (m2 (m3 (m4 (m5 a)))) -> (e -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))+catchError5 = cover4Catch catchError+  where+    cover4Catch :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5) => +                   (forall a. m5 a -> (e -> m5 a) -> m5 a) -> +                    m1 (m2 (m3 (m4 (m5 a)))) -> (e -> m1 (m2 (m3 (m4 (m5 a))))) -> m1 (m2 (m3 (m4 (m5 a))))+    cover4Catch catch m h = +        let m' = float4 m+            h' = float4 |$> h+        in sink4 $ catch m' h'++----------------------------------------------------------------+-- Level-6++{-+cover5Catch :: (Commutative m1, Commutative m2, Commutative m3, Commutative m4, Commutative m5, Commutative m6) => +               (forall a. m6 a -> (e -> m6 a) -> m6 a) -> +                m1 (m2 (m3 (m4 (m5 (m6 a))))) -> (e -> m1 (m2 (m3 (m4 (m5 (m6 a)))))) -> m1 (m2 (m3 (m4 (m5 (m6 a)))))+cover5Catch catch m h = +    let m' = float5 m+        h' = float5 |$> h+    in sink5 $ catch m' h'+-}
DeepControl/Monad/Trans/RWS.hs view
@@ -14,26 +14,32 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE DeriveFunctor #-} module DeepControl.Monad.Trans.RWS (     module Control.Monad.RWS,     MonadReader(..), MonadWriter(..), MonadState(..),      -- * Level-2     RWST2(..), rwsT2, evalRWST2, execRWST2, mapRWST2, withRWST2, +    -- ** lift function+    liftCatch2,+     -- * Level-3     RWST3(..), rwsT3, evalRWST3, execRWST3, mapRWST3, withRWST3, +    -- ** lift function+    liftCatch3,      ) where   import DeepControl.Applicative import DeepControl.Monad+import DeepControl.Monad.Signatures import DeepControl.Monad.Trans  import Control.Monad.Reader (MonadReader(..)) import Control.Monad.Writer (MonadWriter(..)) import Control.Monad.State (MonadState(..)) import Control.Monad.RWS-import Control.Monad.Signatures import Data.Monoid  ----------------------------------------------------------------------@@ -49,10 +55,12 @@ -- Level-2  newtype RWST2 r w s m1 m2 a = RWST2 { runRWST2 :: r -> s -> m1 (m2 (a, s, w)) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2) => Functor (RWST2 r w s m1 m2) where     fmap f m = RWST2 $ \r s ->         (\(a, s', w) -> (f a, s', w)) |$>> runRWST2 m r s+-} instance (Monoid w, Monad m1, Monad2 m2) => Applicative (RWST2 r w s m1 m2) where     pure a = RWST2 $ \_ s -> (**:) (a, s, mempty)     (<*>)  = ap@@ -85,6 +93,17 @@ instance (Monoid w, MonadIO m1, Monad m1, Monad2 m2) => MonadIO (RWST2 r w s m1 m2) where     liftIO = lift2 . (-*) . liftIO +instance (Monoid w) => MonadTrans2Down (RWST2 r w s) where+    type Trans2Down (RWST2 r w s) = RWST r w s++instance (Monoid w) => MonadTransFold2 (RWST2 r w s) where+    transfold2 (RWST2 x) = RWST $ trans |$>> x+    untransfold2 (RWST x) = RWST2 $ untrans |$>> x++instance (Monoid w) => MonadTransCover2 (RWST2 r w s) where+    (|-*|) = RWST2 . ((-*)|$>>) . runRWST+    (|*-|) = RWST2 . ((*-)|$>>) . runRWST+ rwsT2 :: (Monad m1, Monad2 m2) => (r -> s -> (a, s, w)) -> RWST2 r w s m1 m2 a rwsT2 = RWST2 . ((**:)|$>>) evalRWST2 :: (Monad m1, Monad2 m2) => RWST2 r w s m1 m2 a -> r -> s -> m1 (m2 (a, w))@@ -101,25 +120,26 @@ withRWST2 :: (r' -> s -> (r, s)) -> RWST2 r w s m1 m2 a -> RWST2 r' w s m1 m2 a withRWST2 f m = RWST2 $ \r s -> uncurry (runRWST2 m) (f r s) -instance (Monoid w) => MonadTrans2Down (RWST2 r w s) where-    type Trans2Down (RWST2 r w s) = RWST r w s--instance (Monoid w) => MonadTransFold2 (RWST2 r w s) where-    transfold2 (RWST2 x) = RWST $ trans |$>> x-    untransfold2 (RWST x) = RWST2 $ untrans |$>> x+liftCatch2 :: Catch2 e m1 m2 (a,s,w) -> Catch e (RWST2 r w s m1 m2) a+liftCatch2 catch m h = RWST2 $ \r s -> runRWST2 m r s `catch` \e -> runRWST2 (h e) r s -instance (Monoid w) => MonadTransCover2 (RWST2 r w s) where-    (|-*|) = RWST2 . ((-*)|$>>) . runRWST-    (|*-|) = RWST2 . ((*-)|$>>) . runRWST+instance (Monoid w, MonadPlus m1, MonadPlus m2, Monad m1, Monad2 m2) => MonadPlus (RWST2 r w s m1 m2) where+    mzero       = RWST2 $ \_ _ -> mzero+    m `mplus` n = RWST2 $ \r s -> runRWST2 m r s <$|mplus|*> runRWST2 n r s+instance (Monoid w, MonadPlus m1, MonadPlus m2, Monad m1, Monad2 m2) => Alternative (RWST2 r w s m1 m2) where+    empty = mzero+    (<|>) = mplus  ---------------------------------------------------------------------- -- Level-3  newtype RWST3 r w s m1 m2 m3 a = RWST3 { runRWST3 :: r -> s -> m1 (m2 (m3 (a, s, w))) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2, Functor m3) => Functor (RWST3 r w s m1 m2 m3) where     fmap f m = RWST3 $ \r s ->         (\(a, s', w) -> (f a, s', w)) |$>>> runRWST3 m r s+-} instance (Monoid w, Monad m1, Monad2 m2, Monad3 m3) => Applicative (RWST3 r w s m1 m2 m3) where     pure a = RWST3 $ \_ s -> (***:) (a, s, mempty)     (<*>)  = ap@@ -152,6 +172,18 @@ instance (Monoid w, MonadIO m1, Monad m1, Monad2 m2, Monad3 m3) => MonadIO (RWST3 r w s m1 m2 m3) where     liftIO = lift3 . (-**) . liftIO +instance (Monoid w) => MonadTrans3Down (RWST3 r w s) where+    type Trans3Down (RWST3 r w s) = RWST2 r w s++instance (Monoid w) => MonadTransFold3 (RWST3 r w s) where+    transfold3 (RWST3 x) = RWST $ trans2 |$>> x+    untransfold3 (RWST x) = RWST3 $ untrans2 |$>> x++instance (Monoid w) => MonadTransCover3 (RWST3 r w s) where+    (|--*|) = RWST3 . ((--*)|$>>) . runRWST2+    (|-*-|) = RWST3 . ((-*-)|$>>) . runRWST2+    (|*--|) = RWST3 . ((*--)|$>>) . runRWST2+ rwsT3 :: (Monad m1, Monad2 m2, Monad3 m3) => (r -> s -> (a, s, w)) -> RWST3 r w s m1 m2 m3 a rwsT3 = RWST3 . ((***:)|$>>) evalRWST3 :: (Monad m1, Monad2 m2, Monad3 m3) => RWST3 r w s m1 m2 m3 a -> r -> s -> m1 (m2 (m3 (a, w)))@@ -168,15 +200,13 @@ withRWST3 :: (r' -> s -> (r, s)) -> RWST3 r w s m1 m2 m3 a -> RWST3 r' w s m1 m2 m3 a withRWST3 f m = RWST3 $ \r s -> uncurry (runRWST3 m) (f r s) -instance (Monoid w) => MonadTrans3Down (RWST3 r w s) where-    type Trans3Down (RWST3 r w s) = RWST2 r w s--instance (Monoid w) => MonadTransFold3 (RWST3 r w s) where-    transfold3 (RWST3 x) = RWST $ trans2 |$>> x-    untransfold3 (RWST x) = RWST3 $ untrans2 |$>> x+liftCatch3 :: Catch3 e m1 m2 m3 (a,s,w) -> Catch e (RWST3 r w s m1 m2 m3) a+liftCatch3 catch m h = RWST3 $ \r s -> runRWST3 m r s `catch` \e -> runRWST3 (h e) r s -instance (Monoid w) => MonadTransCover3 (RWST3 r w s) where-    (|--*|) = RWST3 . ((--*)|$>>) . runRWST2-    (|-*-|) = RWST3 . ((-*-)|$>>) . runRWST2-    (|*--|) = RWST3 . ((*--)|$>>) . runRWST2+instance (Monoid w, MonadPlus m1, MonadPlus m2, MonadPlus m3, Monad m1, Monad2 m2, Monad3 m3) => MonadPlus (RWST3 r w s m1 m2 m3) where+    mzero       = RWST3 $ \_ _ -> mzero+    m `mplus` n = RWST3 $ \r s -> runRWST3 m r s <<$|mplus|*>> runRWST3 n r s+instance (Monoid w, MonadPlus m1, MonadPlus m2, MonadPlus m3, Monad m1, Monad2 m2, Monad3 m3) => Alternative (RWST3 r w s m1 m2 m3) where+    empty = mzero+    (<|>) = mplus 
DeepControl/Monad/Trans/Reader.hs view
@@ -11,27 +11,34 @@ Stability   : experimental Portability : --- -This module extended Reader Monad in mtl(monad-transformer-library).+This module extended Reader Monad of mtl(monad-transformer-library). -} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE DeriveFunctor #-} module DeepControl.Monad.Trans.Reader (     module Control.Monad.Reader,      -- * Level-2-    ReaderT2(..), mapReaderT2,+    ReaderT2(..), mapReaderT2, +    -- ** lift function+    liftCatch2,+     -- * Level-3-    ReaderT3(..), mapReaderT3,+    ReaderT3(..), mapReaderT3, +    -- ** lift function+    liftCatch3,          ) where   import DeepControl.Applicative import DeepControl.Monad+import DeepControl.Monad.Signatures import DeepControl.Monad.Trans  import Control.Monad.Reader -import Control.Monad.Signatures  ---------------------------------------------------------------------- -- Level-1@@ -46,10 +53,12 @@ -- Level-2  newtype ReaderT2 r m1 m2 a = ReaderT2 { runReaderT2 :: r -> m1 (m2 a) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2) => Functor (ReaderT2 r m1 m2) where     fmap f m = ReaderT2 $ \r ->         f |$>> runReaderT2 m r+-} instance (Monad m1, Monad2 m2) => Applicative (ReaderT2 s m1 m2) where     pure a = ReaderT2 $ \_ -> (**:) a     (<*>)  = ap@@ -69,9 +78,6 @@ instance (MonadIO m1, Monad m1, Monad2 m2) => MonadIO (ReaderT2 r m1 m2) where     liftIO = lift2 . (-*) . liftIO -mapReaderT2 :: (m1 (m2 a) -> n1 (n2 b)) -> ReaderT2 r m1 m2 a -> ReaderT2 r n1 n2 b-mapReaderT2 f m = ReaderT2 $ f . runReaderT2 m- instance MonadTrans2Down (ReaderT2 r) where     type Trans2Down (ReaderT2 r) = ReaderT r @@ -83,14 +89,29 @@     (|-*|) = ReaderT2 . ((-*)|$>) . runReaderT     (|*-|) = ReaderT2 . ((*-)|$>) . runReaderT +mapReaderT2 :: (m1 (m2 a) -> n1 (n2 b)) -> ReaderT2 r m1 m2 a -> ReaderT2 r n1 n2 b+mapReaderT2 f m = ReaderT2 $ f . runReaderT2 m++liftCatch2 :: Catch2 e m1 m2 a -> Catch e (ReaderT2 r m1 m2) a+liftCatch2 catch m h = ReaderT2 $ \r -> (runReaderT2 m r) `catch` (\e -> runReaderT2 (h e) r)++instance (Alternative m1, Alternative m2, Monad m1, Monad2 m2) => Alternative (ReaderT2 r m1 m2) where+    empty   = ReaderT2 (const empty)+    m <|> n = ReaderT2 $ \r -> runReaderT2 m r <$|(<|>)|*> runReaderT2 n r+instance (MonadPlus m1, MonadPlus m2, Monad m1, Monad2 m2) => MonadPlus (ReaderT2 r m1 m2) where+    mzero       = lift2 mzero+    m `mplus` n = ReaderT2 $ \r -> runReaderT2 m r <$|mplus|*> runReaderT2 n r+ ---------------------------------------------------------------------- -- Level-3  newtype ReaderT3 r m1 m2 m3 a = ReaderT3 { runReaderT3 :: r -> m1 (m2 (m3 a)) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2, Functor m3) => Functor (ReaderT3 r m1 m2 m3) where     fmap f m = ReaderT3 $ \r ->         f |$>>> runReaderT3 m r+-} instance (Monad m1, Monad2 m2, Monad3 m3) => Applicative (ReaderT3 s m1 m2 m3) where     pure a = ReaderT3 $ \_ -> (***:) a     (<*>)  = ap@@ -110,9 +131,6 @@ instance (MonadIO m1, Monad m1, Monad2 m2, Monad3 m3) => MonadIO (ReaderT3 r m1 m2 m3) where     liftIO = lift3 . (-**) . liftIO -mapReaderT3 :: (m1 (m2 (m3 a)) -> n1 (n2 (n3 b))) -> ReaderT3 r m1 m2 m3 a -> ReaderT3 r n1 n2 n3 b-mapReaderT3 f m = ReaderT3 $ f . runReaderT3 m- instance MonadTrans3Down (ReaderT3 r) where     type Trans3Down (ReaderT3 r) = ReaderT2 r @@ -124,4 +142,17 @@     (|--*|) = ReaderT3 . ((--*)|$>) . runReaderT2     (|-*-|) = ReaderT3 . ((-*-)|$>) . runReaderT2     (|*--|) = ReaderT3 . ((*--)|$>) . runReaderT2++mapReaderT3 :: (m1 (m2 (m3 a)) -> n1 (n2 (n3 b))) -> ReaderT3 r m1 m2 m3 a -> ReaderT3 r n1 n2 n3 b+mapReaderT3 f m = ReaderT3 $ f . runReaderT3 m++liftCatch3 :: Catch3 e m1 m2 m3 a -> Catch e (ReaderT3 r m1 m2 m3) a+liftCatch3 catch m h = ReaderT3 $ \r -> (runReaderT3 m r) `catch` (\e -> runReaderT3 (h e) r)++instance (MonadPlus m1, MonadPlus m2, MonadPlus m3, Monad m1, Monad2 m2, Monad3 m3) => MonadPlus (ReaderT3 r m1 m2 m3) where+    mzero       = lift3 mzero+    m `mplus` n = ReaderT3 $ \r -> runReaderT3 m r <<$|mplus|*>> runReaderT3 n r+instance (Alternative m1, Alternative m2, Alternative m3, Monad m1, Monad2 m2, Monad3 m3) => Alternative (ReaderT3 r m1 m2 m3) where+    empty   = ReaderT3 (const empty)+    m <|> n = ReaderT3 $ \r -> runReaderT3 m r <<$|(<|>)|*>> runReaderT3 n r 
DeepControl/Monad/Trans/State.hs view
@@ -10,27 +10,33 @@ Stability   : experimental Portability : --- -This module extended State Monad in mtl(monad-transformer-library).+This module extended State Monad of mtl(monad-transformer-library). -} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE DeriveFunctor #-} module DeepControl.Monad.Trans.State (     module Control.Monad.State,      -- * Level-2     StateT2(..), evalStateT2, execStateT2, mapStateT2, withStateT2, +    -- ** lift functions+    liftCatch2, liftListen2, liftPass2,+     -- * Level-3-    StateT3(..), evalStateT3, execStateT3, mapStateT3, withStateT3, +    StateT3(..), evalStateT3, execStateT3, mapStateT3, withStateT3,+    -- ** lift functions+    liftCatch3, liftListen3, liftPass3,      ) where   import DeepControl.Applicative import DeepControl.Monad+import DeepControl.Monad.Signatures import DeepControl.Monad.Trans  import Control.Monad.State -import Control.Monad.Signatures  ---------------------------------------------------------------------- -- Level-1@@ -45,10 +51,12 @@ -- Level-2  newtype StateT2 s m1 m2 a = StateT2 { runStateT2 :: (s -> m1 (m2 (a,s))) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2) => Functor (StateT2 s m1 m2) where     fmap f v = StateT2 $ \s ->         (\(a, s') -> (f a, s')) |$>> runStateT2 v s+-} instance (Monad m1, Monad2 m2) => Applicative (StateT2 s m1 m2) where     pure a = StateT2 $ \s -> (**:) (a,s)     (<*>)  = ap@@ -69,6 +77,17 @@ instance (MonadIO m1, Monad m1, Monad2 m2) => MonadIO (StateT2 s m1 m2) where     liftIO = lift2 . (-*) . liftIO +instance MonadTrans2Down (StateT2 s) where+    type Trans2Down (StateT2 s) = StateT s++instance MonadTransFold2 (StateT2 s) where+    transfold2 (StateT2 x) = StateT $ x <$| trans+    untransfold2 (StateT x) = StateT2 $ x <$| untrans++instance MonadTransCover2 (StateT2 w) where+    (|-*|) = StateT2 . ((-*)|$>) . runStateT+    (|*-|) = StateT2 . ((*-)|$>) . runStateT+ evalStateT2 :: (Monad m1, Monad2 m2) => StateT2 s m1 m2 a -> s -> m1 (m2 a) evalStateT2 m s =      runStateT2 m s >>== \(a, _) ->@@ -83,25 +102,34 @@ withStateT2 :: (s -> s) -> StateT2 s m1 m2 a -> StateT2 s m1 m2 a withStateT2 f m = StateT2 $ runStateT2 m . f -instance MonadTrans2Down (StateT2 s) where-    type Trans2Down (StateT2 s) = StateT s--instance MonadTransFold2 (StateT2 s) where-    transfold2 (StateT2 x) = StateT $ x <$| trans-    untransfold2 (StateT x) = StateT2 $ x <$| untrans+liftCatch2 :: Catch2 e m1 m2 (a,s) -> Catch e (StateT2 s m1 m2) a+liftCatch2 catch m h = StateT2 $ \s -> runStateT2 m s `catch` \e -> runStateT2 (h e) s+liftListen2 :: (Monad m1, Monad2 m2) => Listen2 w m1 m2 (a,s) -> Listen w (StateT2 s m1 m2) a+liftListen2 listen m = StateT2 $ \s -> +    listen (runStateT2 m s) >>== \((a, s'), w) ->+    (**:) ((a, w), s')+liftPass2 :: (Monad m1, Monad2 m2) => Pass2 w m1 m2 (a,s) -> Pass w (StateT2 s m1 m2) a+liftPass2 pass m = StateT2 $ \s -> pass $+    runStateT2 m s >>== \((a, f), s') ->+    (**:) ((a, s'), f) -instance MonadTransCover2 (StateT2 w) where-    (|-*|) = StateT2 . ((-*)|$>) . runStateT-    (|*-|) = StateT2 . ((*-)|$>) . runStateT+instance (MonadPlus m1, MonadPlus m2, Monad m1, Monad2 m2) => MonadPlus (StateT2 s m1 m2) where+    mzero       = StateT2 $ \ _ -> mzero+    m `mplus` n = StateT2 $ \ s -> runStateT2 m s <$|mplus|*> runStateT2 n s+instance (MonadPlus m1, MonadPlus m2, Monad m1, Monad2 m2) => Alternative (StateT2 s m1 m2) where+    empty = mzero+    (<|>) = mplus  ---------------------------------------------------------------------- -- Level-3  newtype StateT3 s m1 m2 m3 a = StateT3 { runStateT3 :: (s -> m1 (m2 (m3 (a,s)))) }-+    deriving (Functor)+{- instance (Functor m1, Functor m2, Functor m3) => Functor (StateT3 s m1 m2 m3) where     fmap f v = StateT3 $ \s ->         (\(a, s') -> (f a, s')) |$>>> runStateT3 v s+-} instance (Monad m1, Monad2 m2, Monad3 m3) => Applicative (StateT3 s m1 m2 m3) where     pure a = StateT3 $ \s -> (***:) (a,s)     (<*>)  = ap@@ -122,6 +150,18 @@ instance (MonadIO m1, Monad m1, Monad2 m2, Monad3 m3) => MonadIO (StateT3 s m1 m2 m3) where     liftIO = lift3 . (-**) . liftIO +instance MonadTrans3Down (StateT3 s) where+    type Trans3Down (StateT3 s) = StateT2 s++instance MonadTransFold3 (StateT3 s) where+    transfold3 (StateT3 x) = StateT $ x <$| trans2+    untransfold3 (StateT x) = StateT3 $ x <$| untrans2++instance MonadTransCover3 (StateT3 s) where+    (|--*|) = StateT3 . ((--*)|$>) . runStateT2+    (|-*-|) = StateT3 . ((-*-)|$>) . runStateT2+    (|*--|) = StateT3 . ((*--)|$>) . runStateT2+ evalStateT3 :: (Monad m1, Monad2 m2, Monad3 m3) => StateT3 s m1 m2 m3 a -> s -> m1 (m2 (m3 a)) evalStateT3 m s =      runStateT3 m s >>>== \(a, _) ->@@ -136,15 +176,22 @@ withStateT3 :: (s -> s) -> StateT3 s m1 m2 m3 a -> StateT3 s m1 m2 m3 a withStateT3 f m = StateT3 $ runStateT3 m . f -instance MonadTrans3Down (StateT3 s) where-    type Trans3Down (StateT3 s) = StateT2 s+liftCatch3 :: Catch3 e m1 m2 m3 (a,s) -> Catch e (StateT3 s m1 m2 m3) a+liftCatch3 catch m h = StateT3 $ \s -> runStateT3 m s `catch` \e -> runStateT3 (h e) s+liftListen3 :: (Monad m1, Monad2 m2, Monad3 m3) => Listen3 w m1 m2 m3 (a,s) -> Listen w (StateT3 s m1 m2 m3) a+liftListen3 listen m = StateT3 $ \s -> +    listen (runStateT3 m s) >>>== \((a, s'), w) ->+    (***:) ((a, w), s')+liftPass3 :: (Monad m1, Monad2 m2, Monad3 m3) => Pass3 w m1 m2 m3 (a,s) -> Pass w (StateT3 s m1 m2 m3) a+liftPass3 pass m = StateT3 $ \s -> pass $+    runStateT3 m s >>>== \((a, f), s') ->+    (***:) ((a, s'), f) -instance MonadTransFold3 (StateT3 s) where-    transfold3 (StateT3 x) = StateT $ x <$| trans2-    untransfold3 (StateT x) = StateT3 $ x <$| untrans2+instance (MonadPlus m1, MonadPlus m2, MonadPlus m3, Monad m1, Monad2 m2, Monad3 m3) => MonadPlus (StateT3 s m1 m2 m3) where+    mzero       = StateT3 $ \ _ -> mzero+    m `mplus` n = StateT3 $ \ s -> runStateT3 m s <<$|mplus|*>> runStateT3 n s+instance (MonadPlus m1, MonadPlus m2, MonadPlus m3, Monad m1, Monad2 m2, Monad3 m3) => Alternative (StateT3 s m1 m2 m3) where+    empty = mzero+    (<|>) = mplus -instance MonadTransCover3 (StateT3 s) where-    (|--*|) = StateT3 . ((--*)|$>) . runStateT2-    (|-*-|) = StateT3 . ((-*-)|$>) . runStateT2-    (|*--|) = StateT3 . ((*--)|$>) . runStateT2 
DeepControl/Monad/Trans/Writer.hs view
@@ -9,71 +9,118 @@ Stability   : experimental Portability : --- -This module extended Writer Monad in mtl(monad-transformer-library).+This module extended Writer Monad of mtl(monad-transformer-library). -}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE TypeFamilies #-} module DeepControl.Monad.Trans.Writer (     module Control.Monad.Writer,      -- * Level-2-    WriterT2(..), execWriterT2, mapWriterT2,+    listen2, pass2,     -- * Level-3-    WriterT3(..), execWriterT3, mapWriterT3,+    listen3, pass3,+    -- * Level-4+    --listen4, pass4,+    -- * Level-5+    --listen5, pass5, +{-+    -- * Level-2+    WriterT2(..), execWriterT2, mapWriterT2, liftCatch2,+    -- * Level-3+    WriterT3(..), execWriterT3, mapWriterT3, liftCatch3,+-}     ) where   import DeepControl.Applicative+import DeepControl.Commutative import DeepControl.Monad+import DeepControl.Monad.Signatures import DeepControl.Monad.Trans  import Control.Monad.Writer-import Control.Monad.Signatures-import Data.Monoid import Control.Monad.Identity+import Data.Monoid  ---------------------------------------------------------------------- -- Level-1 +instance (Monoid w) => Commutative (Writer w) where+    commute x = +        let (a, b) = runWriter x+        in  (WriterT . Identity) |$> (a <$|(,)|* b)++----------------------------------------------------------------------+-- Level-2+ instance (Monoid w) => Monad2 (Writer w) where     mv >>== f =          mv >>= \x -> runWriterT x >- \(Identity (a, w)) ->         f a <$| (\x -> runWriterT x >- \(Identity (b, w')) ->                        WriterT $ Identity (b, w <> w'))++listen2 :: (MonadWriter w m2, Applicative m1) => m1 (m2 a) -> m1 (m2 (a, w))+listen2 m = listen |$> m+pass2 :: (MonadWriter w m2, Applicative m1) => m1 (m2 (a, w -> w)) -> m1 (m2 a)+pass2 m = pass |$> m++----------------------------------------------------------------------+-- Level-3+ instance (Monoid w) => Monad3 (Writer w) where     mv >>>== f =          mv >>== \x -> runWriterT x >- \(Identity (a, w)) ->         f a <<$| (\x -> runWriterT x >- \(Identity (b, w')) ->                         WriterT $ Identity (b, w <> w'))++listen3 :: (MonadWriter w m3, Applicative m1, Applicative m2) => m1 (m2 (m3 a)) -> m1 (m2 (m3 (a, w)))+listen3 m = listen2 |$> m+pass3 :: (MonadWriter w m3, Applicative m1, Applicative m2) => m1 (m2 (m3 (a, w -> w))) -> m1 (m2 (m3 a))+pass3 m = pass2 |$> m++----------------------------------------------------------------------+-- Level-4+ instance (Monoid w) => Monad4 (Writer w) where     mv >>>>== f =          mv >>>== \x -> runWriterT x >- \(Identity (a, w)) ->         f a <<<$| (\x -> runWriterT x >- \(Identity (b, w')) ->                          WriterT $ Identity (b, w <> w'))++----------------------------------------------------------------------+-- Level-5+ instance (Monoid w) => Monad5 (Writer w) where     mv >>>>>== f =          mv >>>>== \x -> runWriterT x >- \(Identity (a, w)) ->         f a <<<<$| (\x -> runWriterT x >- \(Identity (b, w')) ->                           WriterT $ Identity (b, w <> w')) +++{-+----------------------------------------------------------------------+-- Level-1++ instance (Monoid w) => MonadTrans_ (WriterT w) where     untrans x = (WriterT . Identity) |$> runWriterT x     trans x   = WriterT ((runIdentity . runWriterT) |$> x)- instance (Monoid w) => MonadTransDown (WriterT w) where     type TransDown (WriterT w) = Writer w- instance (Monoid w) => MonadTransCover (WriterT w) where     (|*|) = WriterT . (*:) . runWriter  ---------------------------------------------------------------------- -- Level-2 -newtype WriterT2 w m1 m2 a = WriterT2 { runWriterT2 :: m1 (m2 (a, w)) } +newtype WriterT2 w m1 m2 a = WriterT2 { runWriterT2 :: m1 (m2 (a, w)) }+    deriving (Functor)+{- instance (Monad m1, Monad2 m2) => Functor (WriterT2 w m1 m2) where-    fmap f v = WriterT2 $ (\(a, w) -> (f a, w)) |$>> (runWriterT2 v)+    fmap f v = WriterT2 $ (\(a, w) -> (f a, w)) |$>> runWriterT2 v+-} instance (Monoid w, Monad m1, Monad2 m2) => Applicative (WriterT2 w m1 m2) where     pure a = WriterT2 $ (**:) (a, mempty)     (<*>)  = ap@@ -100,32 +147,35 @@ instance (Monoid w, MonadIO m1, Monad m1, Monad2 m2) => MonadIO (WriterT2 w m1 m2) where     liftIO = lift2 . (-*) . liftIO -execWriterT2 :: (Monad m1, Monad2 m2) => WriterT2 w m1 m2 a -> m1 (m2 w)-execWriterT2 m =-    runWriterT2 m >>== \(_, w) ->-    (**:) w--mapWriterT2 :: (m1 (m2 (a, w)) -> n1 (n2 (b, w'))) -> WriterT2 w m1 m2 a -> WriterT2 w' n1 n2 b-mapWriterT2 f m = WriterT2 $ f (runWriterT2 m)- instance (Monoid w) => MonadTrans2Down (WriterT2 w) where     type Trans2Down (WriterT2 w) = WriterT w- instance (Monoid w) => MonadTransFold2 (WriterT2 w) where     transfold2 (WriterT2 x) = WriterT $ trans x     untransfold2 (WriterT x) = WriterT2 $ untrans x- instance (Monoid w) => MonadTransCover2 (WriterT2 w) where     (|-*|) = WriterT2 . (-*) . runWriterT     (|*-|) = WriterT2 . (*-) . runWriterT +execWriterT2 :: (Monad m1, Monad2 m2) => WriterT2 w m1 m2 a -> m1 (m2 w)+execWriterT2 m =+    runWriterT2 m >>== \(_, w) ->+    (**:) w++mapWriterT2 :: (m1 (m2 (a, w)) -> n1 (n2 (b, w'))) -> WriterT2 w m1 m2 a -> WriterT2 w' n1 n2 b+mapWriterT2 f m = WriterT2 $ f (runWriterT2 m)++liftCatch2 :: Catch2 e m1 m2 (a,w) -> Catch e (WriterT2 w m1 m2) a+liftCatch2 catch m h = WriterT2 $ runWriterT2 m `catch` \e -> runWriterT2 (h e)+ ---------------------------------------------------------------------- -- Level-3  newtype WriterT3 w m1 m2 m3 a = WriterT3 { runWriterT3 :: m1 (m2 (m3 (a, w))) }-+    deriving (Functor)+{- instance (Monad m1, Monad2 m2, Monad3 m3) => Functor (WriterT3 w m1 m2 m3) where-    fmap f v = WriterT3 $ (\(a, w) -> (f a, w)) |$>>> (runWriterT3 v)+    fmap f v = WriterT3 $ (\(a, w) -> (f a, w)) |$>>> runWriterT3 v+-} instance (Monoid w, Monad m1, Monad2 m2, Monad3 m3) => Applicative (WriterT3 w m1 m2 m3) where     pure a = WriterT3 $ (***:) (a, mempty)     (<*>)  = ap@@ -152,14 +202,6 @@ instance (Monoid w, MonadIO m1, Monad m1, Monad2 m2, Monad3 m3) => MonadIO (WriterT3 w m1 m2 m3) where     liftIO = lift3 . (-**) . liftIO -execWriterT3 :: (Monad m1, Monad2 m2, Monad3 m3) => WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 w))-execWriterT3 m =-    runWriterT3 m >>>== \(_, w) ->-    (***:) w--mapWriterT3 :: (m1 (m2 (m3 (a, w))) -> n1 (n2 (n3 (b, w')))) -> WriterT3 w m1 m2 m3 a -> WriterT3 w' n1 n2 n3 b-mapWriterT3 f m = WriterT3 $ f (runWriterT3 m)- instance (Monoid w) => MonadTrans3Down (WriterT3 w) where     type Trans3Down (WriterT3 w) = WriterT2 w @@ -172,3 +214,14 @@     (|-*-|) = WriterT3 . (-*-) . runWriterT2     (|*--|) = WriterT3 . (*--) . runWriterT2 +execWriterT3 :: (Monad m1, Monad2 m2, Monad3 m3) => WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 w))+execWriterT3 m =+    runWriterT3 m >>>== \(_, w) ->+    (***:) w++mapWriterT3 :: (m1 (m2 (m3 (a, w))) -> n1 (n2 (n3 (b, w')))) -> WriterT3 w m1 m2 m3 a -> WriterT3 w' n1 n2 n3 b+mapWriterT3 f m = WriterT3 $ f (runWriterT3 m)++liftCatch3 :: Catch3 e m1 m2 m3 (a,w) -> Catch e (WriterT3 w m1 m2 m3) a+liftCatch3 catch m h = WriterT3 $ runWriterT3 m `catch` \e -> runWriterT3 (h e)+-}
README.md view
@@ -62,13 +62,13 @@ ### Fetch from [Hackage](https://hackage.haskell.org/package/deepcontrol)  Ok, I(you) got `deepcontrol` isn't in Stackage. Then let's fetch `deepcontrol` from Hackage.-Add `deepcontrol-0.3.2.0` to your extra-deps field in stack.yaml too:+Add `deepcontrol-0.3.3.0` to your extra-deps field in stack.yaml too:  stack.yaml:      extra-deps:     ...-    - deepcontrol-0.3.2.0+    - deepcontrol-0.3.3.0  And type as below: @@ -77,7 +77,7 @@ Stack must fetch and install `deepcontrol` automatically.      ../yourproject$ stack build-    deepcontrol-0.3.2.0: configure+    deepcontrol-0.3.3.0: configure     ...  Now start ghci and see if it works well.@@ -119,7 +119,7 @@  ## Examples -### [Applicative](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Applicative.html)+### [Applicative](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Applicative.html)  This module enables you to program in applicative style for more deeper level than the usual Applicative module expresses. You would soon realize exactly what more deeper level means by reading the example codes below in order.@@ -258,7 +258,7 @@  Not completely written up yet. -### [Monad](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Monad.html)+### [Monad](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Monad.html)  This module enables you to program in Monad for more deeper level than the usual Monad module expresses. You would soon realize exactly what more deeper level means by reading the example codes below in order.@@ -319,7 +319,7 @@ -- 24 -- Just (120,[0,1,1,2,6,24]) ```-### [Monad-Transformer](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Monad-Trans.html)+### [Monad-Transformer](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Monad-Trans.html)  #### Level-2 @@ -388,17 +388,17 @@ -- Tock! -- ((),1) -save    :: StateT Int (Writer [Int]) ()+save :: StateT Int (Writer [Int]) () save = do     n <- get     lift $ tell [n] -program ::                   StateT2 Int IO (Writer [Int]) ()+program ::               StateT2 Int IO (Writer [Int]) () program = replicateM_ 4 $ do     (|-*|) tock-        :: (Monad2     m) => StateT2 Int IO m              ()+        :: (Monad2 m) => StateT2 Int IO m              ()     (|*-|) save-        :: (Monad      m) => StateT2 Int m  (Writer [Int]) ()+        :: (Monad  m) => StateT2 Int m  (Writer [Int]) ()  -- λ> execWriter |$> runStateT2 program 0 -- Tock!@@ -411,7 +411,7 @@  Work well likewise. -### [Monad-Morph](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Monad-Morph.html)+### [Monad-Morph](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Monad-Morph.html)  Here is a monad-morph example, a level-2 monad-morph. @@ -454,6 +454,6 @@ -- [1,2,3,4] ``` -### [Commutative](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Commutative.html)+### [Commutative](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Commutative.html) -### [Arrow](https://hackage.haskell.org/package/deepcontrol-0.3.2.0/docs/DeepControl-Arrow.html)+### [Arrow](https://hackage.haskell.org/package/deepcontrol-0.3.3.0/docs/DeepControl-Arrow.html)
deepcontrol.cabal view
@@ -1,5 +1,5 @@ name:                deepcontrol-version:             0.3.2.0+version:             0.3.3.0 synopsis:            Provide more deeper level style of programming than the usual Control.xxx modules express description:         This module enables more deeper level style of programming than the usual Control.xxx modules express, especially for Applicative and Monad. license:             BSD3@@ -26,6 +26,7 @@                      , DeepControl.Commutative                      , DeepControl.Monad                      , DeepControl.Monad.Morph+                     , DeepControl.Monad.Signatures                      , DeepControl.Monad.Trans                      , DeepControl.Monad.Trans.Except                      , DeepControl.Monad.Trans.RWS