packages feed

effet 0.1.0.0 → 0.2.0.0

raw patch · 16 files changed

+422/−339 lines, 16 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Control.Effect.Cont: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.Via (Control.Effect.Cont.Cont' tag) t m)
- Control.Effect.Cont: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Kind.Transformer) (m :: Control.Effect.Machinery.Kind.SomeMonad) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Embed: instance Control.Effect.Machinery.Kind.Handle (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.Via (Control.Effect.Embed.Embed n) t m)
- Control.Effect.Embed: instance Control.Effect.Machinery.Kind.Lift (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Error: instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Error: instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.Via (Control.Effect.Error.Error' tag e) t m)
- Control.Effect.Machinery.Kind: type Control (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTransControl t)
- Control.Effect.Machinery.Kind: type Effect = SomeMonad -> Constraint
- Control.Effect.Machinery.Kind: type Handle (eff :: Effect) (t :: Transformer) m = eff (t m)
- Control.Effect.Machinery.Kind: type Lift (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTrans t)
- Control.Effect.Machinery.Kind: type SomeMonad = Type -> Type
- Control.Effect.Machinery.Kind: type Transformer = SomeMonad -> Type -> Type
- Control.Effect.Machinery.Via: Via :: t m a -> Via (eff :: Effect) (t :: Transformer) m a
- Control.Effect.Machinery.Via: instance (GHC.Base.Monad (t m), Control.Monad.Base.MonadBase b m, Control.Monad.Trans.Class.MonadTrans t) => Control.Monad.Base.MonadBase b (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: instance (GHC.Base.Monad (t m), Control.Monad.Trans.Control.MonadBaseControl b m, Control.Monad.Trans.Control.MonadTransControl t) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: instance Control.Monad.IO.Class.MonadIO (t m) => Control.Monad.IO.Class.MonadIO (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: instance Control.Monad.Trans.Class.MonadTrans t => Control.Monad.Trans.Class.MonadTrans (Control.Effect.Machinery.Via.Via eff t)
- Control.Effect.Machinery.Via: instance Control.Monad.Trans.Control.MonadTransControl t => Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Machinery.Via.Via eff t)
- Control.Effect.Machinery.Via: instance GHC.Base.Applicative (t m) => GHC.Base.Applicative (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: instance GHC.Base.Functor (t m) => GHC.Base.Functor (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: instance GHC.Base.Monad (t m) => GHC.Base.Monad (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Machinery.Via: newtype Via (eff :: Effect) (t :: Transformer) m a
- Control.Effect.Map: instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Lift (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Map: instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.Via (Control.Effect.Map.Map' tag k2 v) t m)
- Control.Effect.RWS: Separation :: m a -> Separation m a
- Control.Effect.RWS: [runSeparation] :: Separation m a -> m a
- Control.Effect.RWS: ask :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => m_aqMc r_aqM9
- Control.Effect.RWS: ask' :: RWS' tag r w s m => m r
- Control.Effect.RWS: asks :: RWS r w s m => (r -> a) -> m a
- Control.Effect.RWS: asks' :: forall tag r w s m a. RWS' tag r w s m => (r -> a) -> m a
- Control.Effect.RWS: censor :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => (w_aqMa -> w_aqMa) -> m_aqMc a_aqMf -> m_aqMc a_aqMf
- Control.Effect.RWS: censor' :: RWS' tag r w s m => (w -> w) -> m a -> m a
- Control.Effect.RWS: get :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => m_aqMc s_aqMb
- Control.Effect.RWS: get' :: RWS' tag r w s m => m s
- Control.Effect.RWS: gets :: RWS r w s m => (s -> a) -> m a
- Control.Effect.RWS: gets' :: forall tag r w s m a. RWS' tag r w s m => (s -> a) -> m a
- Control.Effect.RWS: instance forall k (tag :: k) r w s (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.RWS.RWS' tag r w s) t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.RWS: instance forall k (tag :: k) r w s (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.RWS.RWS' tag r w s) t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.Via (Control.Effect.RWS.RWS' tag r w s) t m)
- Control.Effect.RWS: instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Tagger.Tagger tag new m)
- Control.Effect.RWS: listen :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => m_aqMc a_aqMe -> m_aqMc (w_aqMa, a_aqMe)
- Control.Effect.RWS: listen' :: RWS' tag r w s m => m a -> m (w, a)
- Control.Effect.RWS: listens :: RWS r w s m => (w -> b) -> m a -> m (b, a)
- Control.Effect.RWS: listens' :: forall tag r w s b m a. RWS' tag r w s m => (w -> b) -> m a -> m (b, a)
- Control.Effect.RWS: local :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => (r_aqM9 -> r_aqM9) -> m_aqMc a_aqMd -> m_aqMc a_aqMd
- Control.Effect.RWS: local' :: RWS' tag r w s m => (r -> r) -> m a -> m a
- Control.Effect.RWS: modify :: RWS r w s m => (s -> s) -> m ()
- Control.Effect.RWS: modify' :: forall tag r w s m. RWS' tag r w s m => (s -> s) -> m ()
- Control.Effect.RWS: modifyStrict :: RWS r w s m => (s -> s) -> m ()
- Control.Effect.RWS: modifyStrict' :: forall tag r w s m. RWS' tag r w s m => (s -> s) -> m ()
- Control.Effect.RWS: newtype Separation m a
- Control.Effect.RWS: put :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => s_aqMb -> m_aqMc ()
- Control.Effect.RWS: put' :: RWS' tag r w s m => s -> m ()
- Control.Effect.RWS: tell :: RWS r_aqM9 w_aqMa s_aqMb m_aqMc => w_aqMa -> m_aqMc ()
- Control.Effect.RWS: tell' :: RWS' tag r w s m => w -> m ()
- Control.Effect.Reader: instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Reader: instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.Via (Control.Effect.Reader.Reader' tag r) t m)
- Control.Effect.Resource: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Resource: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.Via (Control.Effect.Resource.Resource' tag) t m)
- Control.Effect.State: instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Lift (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.State: instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.Via (Control.Effect.State.State' tag s) t m)
- Control.Effect.Writer: instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *) (eff :: Control.Effect.Machinery.Kind.Effect). Control.Effect.Machinery.Kind.Control (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.Via eff t m)
- Control.Effect.Writer: instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Kind.Transformer) (m :: * -> *). Control.Effect.Machinery.Kind.Handle (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.Via (Control.Effect.Writer.Writer' tag w) t m)
+ Control.Effect.Cont: instance forall k (tag :: k) (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Cont.Cont' tag) effs t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Cont: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia (Control.Effect.Cont.Cont' tag : effs) t m)
+ Control.Effect.Cont: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: Control.Effect.Machinery.Via.SomeMonad). Control.Effect.Machinery.Via.Control (Control.Effect.Cont.Cont' tag) t m => Control.Effect.Cont.Cont' tag (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.Embed: instance Control.Effect.Machinery.Via.Find (Control.Effect.Embed.Embed n) effs t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Embed: instance Control.Effect.Machinery.Via.Handle (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia (Control.Effect.Embed.Embed n : effs) t m)
+ Control.Effect.Embed: instance Control.Effect.Machinery.Via.Lift (Control.Effect.Embed.Embed n) t m => Control.Effect.Embed.Embed n (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.Error: instance forall k (tag :: k) e (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Error.Error' tag e) effs t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Error: instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia (Control.Effect.Error.Error' tag e : effs) t m)
+ Control.Effect.Error: instance forall k (tag :: k) e (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Error.Error' tag e) t m => Control.Effect.Error.Error' tag e (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.Machinery.TH: liftL :: EachVia effs t m a -> EachVia (eff : effs) t m a
+ Control.Effect.Machinery.TH: makeFinder :: Name -> Q [Dec]
+ Control.Effect.Machinery.TH: runL :: EachVia (eff : effs) t m a -> EachVia effs t m a
+ Control.Effect.Machinery.Via: EachVia :: t m a -> EachVia (effs :: [Effect]) (t :: Transformer) m a
+ Control.Effect.Machinery.Via: instance (GHC.Base.Monad (t m), Control.Monad.Base.MonadBase b m, Control.Monad.Trans.Class.MonadTrans t) => Control.Monad.Base.MonadBase b (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: instance (GHC.Base.Monad (t m), Control.Monad.Trans.Control.MonadBaseControl b m, Control.Monad.Trans.Control.MonadTransControl t) => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: instance Control.Monad.IO.Class.MonadIO (t m) => Control.Monad.IO.Class.MonadIO (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: instance Control.Monad.Trans.Class.MonadTrans t => Control.Monad.Trans.Class.MonadTrans (Control.Effect.Machinery.Via.EachVia effs t)
+ Control.Effect.Machinery.Via: instance Control.Monad.Trans.Control.MonadTransControl t => Control.Monad.Trans.Control.MonadTransControl (Control.Effect.Machinery.Via.EachVia effs t)
+ Control.Effect.Machinery.Via: instance GHC.Base.Applicative (t m) => GHC.Base.Applicative (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: instance GHC.Base.Functor (t m) => GHC.Base.Functor (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: instance GHC.Base.Monad (t m) => GHC.Base.Monad (Control.Effect.Machinery.Via.EachVia effs t m)
+ Control.Effect.Machinery.Via: newtype EachVia (effs :: [Effect]) (t :: Transformer) m a
+ Control.Effect.Machinery.Via: type Control (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTransControl t)
+ Control.Effect.Machinery.Via: type Effect = SomeMonad -> Constraint
+ Control.Effect.Machinery.Via: type Find eff effs t m = (Monad (t m), eff (EachVia effs t m))
+ Control.Effect.Machinery.Via: type Handle (eff :: Effect) (t :: Transformer) m = eff (t m)
+ Control.Effect.Machinery.Via: type Lift (eff :: Effect) (t :: Transformer) m = (eff m, Monad (t m), MonadTrans t)
+ Control.Effect.Machinery.Via: type SomeMonad = Type -> Type
+ Control.Effect.Machinery.Via: type Transformer = SomeMonad -> Type -> Type
+ Control.Effect.Machinery.Via: type Via eff t m a = EachVia '[eff] t m a
+ Control.Effect.Map: instance forall k1 (tag :: k1) k2 v (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Map.Map' tag k2 v) effs t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Map: instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia (Control.Effect.Map.Map' tag k2 v : effs) t m)
+ Control.Effect.Map: instance forall k1 (tag :: k1) k2 v (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Lift (Control.Effect.Map.Map' tag k2 v) t m => Control.Effect.Map.Map' tag k2 v (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.RWS: data Separation m a
+ Control.Effect.RWS: data Tagger tag new m a
+ Control.Effect.RWS: instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall (b :: * -> *) k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: Control.Effect.Machinery.Via.SomeMonad) (tag :: k) r (effs :: [Control.Effect.Machinery.Via.Effect]) w s. (GHC.Base.Monad (t m), Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia effs t m), Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia effs t m), Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia effs t m)) => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia (Control.Effect.RWS.RWS' tag r w s : effs) t m)
+ Control.Effect.RWS: instance forall k (tag :: k) r (m :: * -> *). Control.Effect.Reader.Reader' tag r m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Separation m)
+ Control.Effect.RWS: instance forall k (tag :: k) r w s (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: Control.Effect.Machinery.Via.SomeMonad) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.RWS.RWS' tag r w s) effs t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.RWS: instance forall k (tag :: k) r w s (t :: Control.Effect.Machinery.Via.Transformer) (m :: Control.Effect.Machinery.Via.SomeMonad). Control.Effect.Machinery.Via.Control (Control.Effect.RWS.RWS' tag r w s) t m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.RWS: instance forall k (tag :: k) s (m :: * -> *). Control.Effect.State.State' tag s m => Control.Effect.State.State' tag s (Control.Effect.RWS.Separation m)
+ Control.Effect.RWS: instance forall k (tag :: k) w (m :: * -> *). Control.Effect.Writer.Writer' tag w m => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Separation m)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Applicative m => GHC.Base.Applicative (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Functor m => GHC.Base.Functor (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2) (m :: * -> *). GHC.Base.Monad m => GHC.Base.Monad (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Class.MonadTrans (Control.Effect.RWS.Tagger tag new)
+ Control.Effect.RWS: instance forall k1 (tag :: k1) k2 (new :: k2). Control.Monad.Trans.Control.MonadTransControl (Control.Effect.RWS.Tagger tag new)
+ Control.Effect.RWS: instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.RWS.RWS' tag r w s (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.State.State' tag s (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS: instance forall k1 k2 (new :: k1) r w s (m :: * -> *) (tag :: k2). Control.Effect.RWS.RWS' new r w s m => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Tagger tag new m)
+ Control.Effect.RWS.Strict: instance forall k (tag :: k) r w s (m :: * -> *). (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Effect.RWS.Strict.RWST r w s m)
+ Control.Effect.RWS.Strict: instance forall k (tag :: k) r w s (m :: * -> *). GHC.Base.Monad m => Control.Effect.Reader.Reader' tag r (Control.Effect.RWS.Strict.RWST r w s m)
+ Control.Effect.RWS.Strict: instance forall k (tag :: k) r w s (m :: * -> *). GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Effect.RWS.Strict.RWST r w s m)
+ Control.Effect.Reader: instance forall k (m :: * -> *) (tag :: k) r w s. GHC.Base.Monad m => Control.Effect.Reader.Reader' tag r (Control.Monad.Trans.RWS.CPS.RWST r w s m)
+ Control.Effect.Reader: instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Reader.Reader' tag r (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
+ Control.Effect.Reader: instance forall k (tag :: k) r (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Reader.Reader' tag r) effs t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Reader: instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia (Control.Effect.Reader.Reader' tag r : effs) t m)
+ Control.Effect.Reader: instance forall k (tag :: k) r (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Reader.Reader' tag r) t m => Control.Effect.Reader.Reader' tag r (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.Resource: instance forall k (tag :: k) (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Resource.Resource' tag) effs t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Resource: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia (Control.Effect.Resource.Resource' tag : effs) t m)
+ Control.Effect.Resource: instance forall k (tag :: k) (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Resource.Resource' tag) t m => Control.Effect.Resource.Resource' tag (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.State: instance forall k (m :: * -> *) (tag :: k) s r w. GHC.Base.Monad m => Control.Effect.State.State' tag s (Control.Monad.Trans.RWS.CPS.RWST r w s m)
+ Control.Effect.State: instance forall k (m :: * -> *) w (tag :: k) s r. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.State.State' tag s (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
+ Control.Effect.State: instance forall k (tag :: k) s (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.State.State' tag s) effs t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.State: instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia (Control.Effect.State.State' tag s : effs) t m)
+ Control.Effect.State: instance forall k (tag :: k) s (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Lift (Control.Effect.State.State' tag s) t m => Control.Effect.State.State' tag s (Control.Effect.Machinery.Via.EachVia '[] t m)
+ Control.Effect.Writer: instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.RWS.CPS.RWST r w s m)
+ Control.Effect.Writer: instance forall k (m :: * -> *) w (tag :: k) r s. (GHC.Base.Monad m, GHC.Base.Monoid w) => Control.Effect.Writer.Writer' tag w (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
+ Control.Effect.Writer: instance forall k (tag :: k) w (effs :: [Control.Effect.Machinery.Via.Effect]) (t :: Control.Effect.Machinery.Via.SomeMonad -> * -> *) (m :: * -> *) (other :: Control.Effect.Machinery.Via.Effect). Control.Effect.Machinery.Via.Find (Control.Effect.Writer.Writer' tag w) effs t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia (other : effs) t m)
+ Control.Effect.Writer: instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *) (effs :: [(* -> *) -> GHC.Types.Constraint]). Control.Effect.Machinery.Via.Handle (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia (Control.Effect.Writer.Writer' tag w : effs) t m)
+ Control.Effect.Writer: instance forall k (tag :: k) w (t :: Control.Effect.Machinery.Via.Transformer) (m :: * -> *). Control.Effect.Machinery.Via.Control (Control.Effect.Writer.Writer' tag w) t m => Control.Effect.Writer.Writer' tag w (Control.Effect.Machinery.Via.EachVia '[] t m)
- Control.Effect.Cont: callCC :: Cont m_ajwD => ((a_ajwE -> m_ajwD b_ajwF) -> m_ajwD a_ajwE) -> m_ajwD a_ajwE
+ Control.Effect.Cont: callCC :: Cont m_ajXN => ((a_ajXO -> m_ajXN b_ajXP) -> m_ajXN a_ajXO) -> m_ajXN a_ajXO
- Control.Effect.Cont: retagCont' :: forall tag_ajzU new_ajzV m_ajzY a_ajzZ. Via (Cont' tag_ajzU) (Tagger tag_ajzU new_ajzV) m_ajzY a_ajzZ -> m_ajzY a_ajzZ
+ Control.Effect.Cont: retagCont' :: forall tag_ak3M new_ak3N m_ak3Q a_ak3R. Via (Cont' tag_ak3M) (Tagger tag_ak3M new_ak3N) m_ak3Q a_ak3R -> m_ak3Q a_ak3R
- Control.Effect.Cont: tagCont' :: forall new_ajzV m_ajzW a_ajzX. Via (Cont' G) (Tagger G new_ajzV) m_ajzW a_ajzX -> m_ajzW a_ajzX
+ Control.Effect.Cont: tagCont' :: forall new_ak3N m_ak3O a_ak3P. Via (Cont' G) (Tagger G new_ak3N) m_ak3O a_ak3P -> m_ak3O a_ak3P
- Control.Effect.Cont: untagCont' :: forall tag_ajzU m_ajA0 a_ajA1. Via (Cont' tag_ajzU) (Tagger tag_ajzU G) m_ajA0 a_ajA1 -> m_ajA0 a_ajA1
+ Control.Effect.Cont: untagCont' :: forall tag_ak3M m_ak3S a_ak3T. Via (Cont' tag_ak3M) (Tagger tag_ak3M G) m_ak3S a_ak3T -> m_ak3S a_ak3T
- Control.Effect.Error: catchError :: Error e_ahLW m_ahLX => m_ahLX a_ahLZ -> (e_ahLW -> m_ahLX a_ahLZ) -> m_ahLX a_ahLZ
+ Control.Effect.Error: catchError :: Error e_ai33 m_ai34 => m_ai34 a_ai36 -> (e_ai33 -> m_ai34 a_ai36) -> m_ai34 a_ai36
- Control.Effect.Error: retagError' :: forall tag_ahNO new_ahNP e_ahLW m_ahNS a_ahNT. Via (Error' tag_ahNO e_ahLW) (Tagger tag_ahNO new_ahNP) m_ahNS a_ahNT -> m_ahNS a_ahNT
+ Control.Effect.Error: retagError' :: forall tag_ai55 new_ai56 e_ai33 m_ai59 a_ai5a. Via (Error' tag_ai55 e_ai33) (Tagger tag_ai55 new_ai56) m_ai59 a_ai5a -> m_ai59 a_ai5a
- Control.Effect.Error: tagError' :: forall new_ahNP e_ahLW m_ahNQ a_ahNR. Via (Error' G e_ahLW) (Tagger G new_ahNP) m_ahNQ a_ahNR -> m_ahNQ a_ahNR
+ Control.Effect.Error: tagError' :: forall new_ai56 e_ai33 m_ai57 a_ai58. Via (Error' G e_ai33) (Tagger G new_ai56) m_ai57 a_ai58 -> m_ai57 a_ai58
- Control.Effect.Error: throwError :: Error e_ahLW m_ahLX => e_ahLW -> m_ahLX a_ahLY
+ Control.Effect.Error: throwError :: Error e_ai33 m_ai34 => e_ai33 -> m_ai34 a_ai35
- Control.Effect.Error: type Error e_ahLW = Error' G e_ahLW
+ Control.Effect.Error: type Error e_ai33 = Error' G e_ai33
- Control.Effect.Error: untagError' :: forall tag_ahNO e_ahLW m_ahNU a_ahNV. Via (Error' tag_ahNO e_ahLW) (Tagger tag_ahNO G) m_ahNU a_ahNV -> m_ahNU a_ahNV
+ Control.Effect.Error: untagError' :: forall tag_ai55 e_ai33 m_ai5b a_ai5c. Via (Error' tag_ai55 e_ai33) (Tagger tag_ai55 G) m_ai5b a_ai5c -> m_ai5b a_ai5c
- Control.Effect.Machinery.Via: [runVia] :: Via (eff :: Effect) (t :: Transformer) m a -> t m a
+ Control.Effect.Machinery.Via: [runVia] :: EachVia (effs :: [Effect]) (t :: Transformer) m a -> t m a
- Control.Effect.Map: clear :: Map k_ak02 v_ak03 m_ak04 => m_ak04 ()
+ Control.Effect.Map: clear :: Map k_akwz v_akwA m_akwB => m_akwB ()
- Control.Effect.Map: lookup :: Map k_ak02 v_ak03 m_ak04 => k_ak02 -> m_ak04 (Maybe v_ak03)
+ Control.Effect.Map: lookup :: Map k_akwz v_akwA m_akwB => k_akwz -> m_akwB (Maybe v_akwA)
- Control.Effect.Map: retagMap' :: forall tag_ak1Z new_ak20 k_ak02 v_ak03 m_ak23 a_ak24. Via (Map' tag_ak1Z k_ak02 v_ak03) (Tagger tag_ak1Z new_ak20) m_ak23 a_ak24 -> m_ak23 a_ak24
+ Control.Effect.Map: retagMap' :: forall tag_akyE new_akyF k_akwz v_akwA m_akyI a_akyJ. Via (Map' tag_akyE k_akwz v_akwA) (Tagger tag_akyE new_akyF) m_akyI a_akyJ -> m_akyI a_akyJ
- Control.Effect.Map: tagMap' :: forall new_ak20 k_ak02 v_ak03 m_ak21 a_ak22. Via (Map' G k_ak02 v_ak03) (Tagger G new_ak20) m_ak21 a_ak22 -> m_ak21 a_ak22
+ Control.Effect.Map: tagMap' :: forall new_akyF k_akwz v_akwA m_akyG a_akyH. Via (Map' G k_akwz v_akwA) (Tagger G new_akyF) m_akyG a_akyH -> m_akyG a_akyH
- Control.Effect.Map: type Map k_ak02 v_ak03 = Map' G k_ak02 v_ak03
+ Control.Effect.Map: type Map k_akwz v_akwA = Map' G k_akwz v_akwA
- Control.Effect.Map: untagMap' :: forall tag_ak1Z k_ak02 v_ak03 m_ak25 a_ak26. Via (Map' tag_ak1Z k_ak02 v_ak03) (Tagger tag_ak1Z G) m_ak25 a_ak26 -> m_ak25 a_ak26
+ Control.Effect.Map: untagMap' :: forall tag_akyE k_akwz v_akwA m_akyK a_akyL. Via (Map' tag_akyE k_akwz v_akwA) (Tagger tag_akyE G) m_akyK a_akyL -> m_akyK a_akyL
- Control.Effect.Map: update :: Map k_ak02 v_ak03 m_ak04 => k_ak02 -> Maybe v_ak03 -> m_ak04 ()
+ Control.Effect.Map: update :: Map k_akwz v_akwA m_akwB => k_akwz -> Maybe v_akwA -> m_akwB ()
- Control.Effect.RWS: class Monad m => RWS' tag r w s m | tag m -> r w s
+ Control.Effect.RWS: class (Reader' tag r m, Writer' tag w m, State' tag s m) => RWS' tag r w s m | tag m -> r w s
- Control.Effect.RWS: retagRWS' :: forall tag_aqQW new_aqQX r_aqM9 w_aqMa s_aqMb m_aqR0 a_aqR1. Via (RWS' tag_aqQW r_aqM9 w_aqMa s_aqMb) (Tagger tag_aqQW new_aqQX) m_aqR0 a_aqR1 -> m_aqR0 a_aqR1
+ Control.Effect.RWS: retagRWS' :: forall tag new r w s m a. ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Tagger tag new) m a -> m a
- Control.Effect.RWS: runSeparatedRWS :: (RWS r w s `Via` Separation) m a -> m a
+ Control.Effect.RWS: runSeparatedRWS :: ('[RWS r w s, Reader r, Writer w, State s] `EachVia` Separation) m a -> m a
- Control.Effect.RWS: runSeparatedRWS' :: (RWS' tag r w s `Via` Separation) m a -> m a
+ Control.Effect.RWS: runSeparatedRWS' :: ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Separation) m a -> m a
- Control.Effect.RWS: tagRWS' :: forall new_aqQX r_aqM9 w_aqMa s_aqMb m_aqQY a_aqQZ. Via (RWS' G r_aqM9 w_aqMa s_aqMb) (Tagger G new_aqQX) m_aqQY a_aqQZ -> m_aqQY a_aqQZ
+ Control.Effect.RWS: tagRWS' :: forall new r w s m a. ('[RWS' G r w s, Reader' G r, Writer' G w, State' G s] `EachVia` Tagger G new) m a -> m a
- Control.Effect.RWS: type RWS r_aqM9 w_aqMa s_aqMb = RWS' G r_aqM9 w_aqMa s_aqMb
+ Control.Effect.RWS: type RWS r w s = RWS' G r w s
- Control.Effect.RWS: untagRWS' :: forall tag_aqQW r_aqM9 w_aqMa s_aqMb m_aqR2 a_aqR3. Via (RWS' tag_aqQW r_aqM9 w_aqMa s_aqMb) (Tagger tag_aqQW G) m_aqR2 a_aqR3 -> m_aqR2 a_aqR3
+ Control.Effect.RWS: untagRWS' :: forall tag r w s m a. ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` Tagger tag G) m a -> m a
- Control.Effect.RWS.Lazy: evalRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, a)
+ Control.Effect.RWS.Lazy: evalRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a)
- Control.Effect.RWS.Lazy: evalRWS' :: forall tag r w s m a. Functor m => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, a)
+ Control.Effect.RWS.Lazy: evalRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, a)
- Control.Effect.RWS.Lazy: execRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s)
+ Control.Effect.RWS.Lazy: execRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s)
- Control.Effect.RWS.Lazy: execRWS' :: forall tag r w s m a. Functor m => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, s)
+ Control.Effect.RWS.Lazy: execRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s)
- Control.Effect.RWS.Lazy: runRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s, a)
+ Control.Effect.RWS.Lazy: runRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a)
- Control.Effect.RWS.Lazy: runRWS' :: forall tag r w s m a. Functor m => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, s, a)
+ Control.Effect.RWS.Lazy: runRWS' :: forall tag r w s m a. Functor m => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s, a)
- Control.Effect.RWS.Strict: evalRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, a)
+ Control.Effect.RWS.Strict: evalRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a)
- Control.Effect.RWS.Strict: evalRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, a)
+ Control.Effect.RWS.Strict: evalRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, a)
- Control.Effect.RWS.Strict: execRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s)
+ Control.Effect.RWS.Strict: execRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s)
- Control.Effect.RWS.Strict: execRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, s)
+ Control.Effect.RWS.Strict: execRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s)
- Control.Effect.RWS.Strict: runRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s, a)
+ Control.Effect.RWS.Strict: runRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a)
- Control.Effect.RWS.Strict: runRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> (RWS' tag r w s `Via` RWST r w s) m a -> m (w, s, a)
+ Control.Effect.RWS.Strict: runRWS' :: forall tag r w s m a. (Functor m, Monoid w) => r -> s -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a -> m (w, s, a)
- Control.Effect.Reader: ask :: Reader r_amn6 m_amn7 => m_amn7 r_amn6
+ Control.Effect.Reader: ask :: Reader r_an2M m_an2N => m_an2N r_an2M
- Control.Effect.Reader: local :: Reader r_amn6 m_amn7 => (r_amn6 -> r_amn6) -> m_amn7 a_amn8 -> m_amn7 a_amn8
+ Control.Effect.Reader: local :: Reader r_an2M m_an2N => (r_an2M -> r_an2M) -> m_an2N a_an2O -> m_an2N a_an2O
- Control.Effect.Reader: reader :: Reader r_amn6 m_amn7 => (r_amn6 -> a_amn9) -> m_amn7 a_amn9
+ Control.Effect.Reader: reader :: Reader r_an2M m_an2N => (r_an2M -> a_an2P) -> m_an2N a_an2P
- Control.Effect.Reader: retagReader' :: forall tag_ampR new_ampS r_amn6 m_ampV a_ampW. Via (Reader' tag_ampR r_amn6) (Tagger tag_ampR new_ampS) m_ampV a_ampW -> m_ampV a_ampW
+ Control.Effect.Reader: retagReader' :: forall tag_an5F new_an5G r_an2M m_an5J a_an5K. Via (Reader' tag_an5F r_an2M) (Tagger tag_an5F new_an5G) m_an5J a_an5K -> m_an5J a_an5K
- Control.Effect.Reader: tagReader' :: forall new_ampS r_amn6 m_ampT a_ampU. Via (Reader' G r_amn6) (Tagger G new_ampS) m_ampT a_ampU -> m_ampT a_ampU
+ Control.Effect.Reader: tagReader' :: forall new_an5G r_an2M m_an5H a_an5I. Via (Reader' G r_an2M) (Tagger G new_an5G) m_an5H a_an5I -> m_an5H a_an5I
- Control.Effect.Reader: type Reader r_amn6 = Reader' G r_amn6
+ Control.Effect.Reader: type Reader r_an2M = Reader' G r_an2M
- Control.Effect.Reader: untagReader' :: forall tag_ampR r_amn6 m_ampX a_ampY. Via (Reader' tag_ampR r_amn6) (Tagger tag_ampR G) m_ampX a_ampY -> m_ampX a_ampY
+ Control.Effect.Reader: untagReader' :: forall tag_an5F r_an2M m_an5L a_an5M. Via (Reader' tag_an5F r_an2M) (Tagger tag_an5F G) m_an5L a_an5M -> m_an5L a_an5M
- Control.Effect.Resource: bracket :: Resource m_an2Q => m_an2Q a_an2R -> (a_an2R -> m_an2Q c_an2S) -> (a_an2R -> m_an2Q b_an2T) -> m_an2Q b_an2T
+ Control.Effect.Resource: bracket :: Resource m_anUP => m_anUP a_anUQ -> (a_anUQ -> m_anUP c_anUR) -> (a_anUQ -> m_anUP b_anUS) -> m_anUP b_anUS
- Control.Effect.Resource: bracketOnError :: Resource m_an2Q => m_an2Q a_an2U -> (a_an2U -> m_an2Q c_an2V) -> (a_an2U -> m_an2Q b_an2W) -> m_an2Q b_an2W
+ Control.Effect.Resource: bracketOnError :: Resource m_anUP => m_anUP a_anUT -> (a_anUT -> m_anUP c_anUU) -> (a_anUT -> m_anUP b_anUV) -> m_anUP b_anUV
- Control.Effect.Resource: retagResource' :: forall tag_an5G new_an5H m_an5K a_an5L. Via (Resource' tag_an5G) (Tagger tag_an5G new_an5H) m_an5K a_an5L -> m_an5K a_an5L
+ Control.Effect.Resource: retagResource' :: forall tag_anY1 new_anY2 m_anY5 a_anY6. Via (Resource' tag_anY1) (Tagger tag_anY1 new_anY2) m_anY5 a_anY6 -> m_anY5 a_anY6
- Control.Effect.Resource: tagResource' :: forall new_an5H m_an5I a_an5J. Via (Resource' G) (Tagger G new_an5H) m_an5I a_an5J -> m_an5I a_an5J
+ Control.Effect.Resource: tagResource' :: forall new_anY2 m_anY3 a_anY4. Via (Resource' G) (Tagger G new_anY2) m_anY3 a_anY4 -> m_anY3 a_anY4
- Control.Effect.Resource: untagResource' :: forall tag_an5G m_an5M a_an5N. Via (Resource' tag_an5G) (Tagger tag_an5G G) m_an5M a_an5N -> m_an5M a_an5N
+ Control.Effect.Resource: untagResource' :: forall tag_anY1 m_anY7 a_anY8. Via (Resource' tag_anY1) (Tagger tag_anY1 G) m_anY7 a_anY8 -> m_anY7 a_anY8
- Control.Effect.State: get :: State s_aoXz m_aoXA => m_aoXA s_aoXz
+ Control.Effect.State: get :: State s_aq02 m_aq03 => m_aq03 s_aq02
- Control.Effect.State: put :: State s_aoXz m_aoXA => s_aoXz -> m_aoXA ()
+ Control.Effect.State: put :: State s_aq02 m_aq03 => s_aq02 -> m_aq03 ()
- Control.Effect.State: retagState' :: forall tag_ap0t new_ap0u s_aoXz m_ap0x a_ap0y. Via (State' tag_ap0t s_aoXz) (Tagger tag_ap0t new_ap0u) m_ap0x a_ap0y -> m_ap0x a_ap0y
+ Control.Effect.State: retagState' :: forall tag_aq32 new_aq33 s_aq02 m_aq36 a_aq37. Via (State' tag_aq32 s_aq02) (Tagger tag_aq32 new_aq33) m_aq36 a_aq37 -> m_aq36 a_aq37
- Control.Effect.State: state :: State s_aoXz m_aoXA => (s_aoXz -> (s_aoXz, a_aoXB)) -> m_aoXA a_aoXB
+ Control.Effect.State: state :: State s_aq02 m_aq03 => (s_aq02 -> (s_aq02, a_aq04)) -> m_aq03 a_aq04
- Control.Effect.State: tagState' :: forall new_ap0u s_aoXz m_ap0v a_ap0w. Via (State' G s_aoXz) (Tagger G new_ap0u) m_ap0v a_ap0w -> m_ap0v a_ap0w
+ Control.Effect.State: tagState' :: forall new_aq33 s_aq02 m_aq34 a_aq35. Via (State' G s_aq02) (Tagger G new_aq33) m_aq34 a_aq35 -> m_aq34 a_aq35
- Control.Effect.State: type State s_aoXz = State' G s_aoXz
+ Control.Effect.State: type State s_aq02 = State' G s_aq02
- Control.Effect.State: untagState' :: forall tag_ap0t s_aoXz m_ap0z a_ap0A. Via (State' tag_ap0t s_aoXz) (Tagger tag_ap0t G) m_ap0z a_ap0A -> m_ap0z a_ap0A
+ Control.Effect.State: untagState' :: forall tag_aq32 s_aq02 m_aq38 a_aq39. Via (State' tag_aq32 s_aq02) (Tagger tag_aq32 G) m_aq38 a_aq39 -> m_aq38 a_aq39
- Control.Effect.Writer: censor :: Writer w_apUZ m_apV0 => (w_apUZ -> w_apUZ) -> m_apV0 a_apV2 -> m_apV0 a_apV2
+ Control.Effect.Writer: censor :: Writer w_araD m_araE => (w_araD -> w_araD) -> m_araE a_araG -> m_araE a_araG
- Control.Effect.Writer: listen :: Writer w_apUZ m_apV0 => m_apV0 a_apV1 -> m_apV0 (w_apUZ, a_apV1)
+ Control.Effect.Writer: listen :: Writer w_araD m_araE => m_araE a_araF -> m_araE (w_araD, a_araF)
- Control.Effect.Writer: retagWriter' :: forall tag_apXi new_apXj w_apUZ m_apXm a_apXn. Via (Writer' tag_apXi w_apUZ) (Tagger tag_apXi new_apXj) m_apXm a_apXn -> m_apXm a_apXn
+ Control.Effect.Writer: retagWriter' :: forall tag_ard6 new_ard7 w_araD m_arda a_ardb. Via (Writer' tag_ard6 w_araD) (Tagger tag_ard6 new_ard7) m_arda a_ardb -> m_arda a_ardb
- Control.Effect.Writer: tagWriter' :: forall new_apXj w_apUZ m_apXk a_apXl. Via (Writer' G w_apUZ) (Tagger G new_apXj) m_apXk a_apXl -> m_apXk a_apXl
+ Control.Effect.Writer: tagWriter' :: forall new_ard7 w_araD m_ard8 a_ard9. Via (Writer' G w_araD) (Tagger G new_ard7) m_ard8 a_ard9 -> m_ard8 a_ard9
- Control.Effect.Writer: tell :: Writer w_apUZ m_apV0 => w_apUZ -> m_apV0 ()
+ Control.Effect.Writer: tell :: Writer w_araD m_araE => w_araD -> m_araE ()
- Control.Effect.Writer: type Writer w_apUZ = Writer' G w_apUZ
+ Control.Effect.Writer: type Writer w_araD = Writer' G w_araD
- Control.Effect.Writer: untagWriter' :: forall tag_apXi w_apUZ m_apXo a_apXp. Via (Writer' tag_apXi w_apUZ) (Tagger tag_apXi G) m_apXo a_apXp -> m_apXo a_apXp
+ Control.Effect.Writer: untagWriter' :: forall tag_ard6 w_araD m_ardc a_ardd. Via (Writer' tag_ard6 w_araD) (Tagger tag_ard6 G) m_ardc a_ardd -> m_ardc a_ardd

Files

ChangeLog.md view
@@ -2,4 +2,9 @@ 
 ## 0.1.0.0 (2020-07-17)
 
-* Initial release+* Initial release
+
+## 0.2.0.0 (2020-07-29)
+
+* Lifted the restriction that one handler can exactly handle one effect. Handlers can now handle multiple effects.
+* Effects whose definitions refer to other effects (see the RWS effect, for example) are now possible to implement, but only manually for now (i.e., no code generation).
README.md view
@@ -282,12 +282,7 @@  ## Limitations and Remarks -* A handler can handle exactly one effect. This restriction might be lifted in the future.-* `TemplateHaskell`-based code generation can yield code that does not compile if you go crazy with `m`-based parameters in higher-order effect methods (where `m` is the monad type parameter of the effect type class). In such cases, one has to write the necessary type class instances by hand.-* It is not possible to define an effect type class based on other effect type classes, like `mtl` does with `RWS` (not to be confused with writing an effect *handler* based on other effects, which is possible). This restriction might be lifted in the future if a handler can handle multiple effects (see the first point). In other words, effect definitions like the following are currently not possible, at least not in combination with the provided code generation infrastructure:-  ```haskell-  class (Reader r m, Writer w m, State s m) => RWS r w s m where-    ...-  ```+* `TemplateHaskell`-based code generation can yield code that does not compile if you go crazy with `m`-based parameters in higher-order effect methods (where `m` is the monad type parameter of the effect type class). In such cases, one has to write the necessary type class instances by hand. They are explained in the documentation of the module `Control.Effect.Machinery.TH`.+* Effect type classes that are based on other effect type classes (like `RWS`) are possible, but cannot be used with the provided code generation infrastructure yet (not to be confused with writing an effect *handler* based on other effects, which is possible). * The performance should be `mtl`-like, but this has not been verified yet. * The library needs some tests.
effet.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12
 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 5e1b55b6a5d186ec023537858ae4098ce19caa92be7cc2d07e60ea0630e75011+-- hash: 397bba600623b58701020a4ec01a2dff5e707d155f8f98e84f63423537604919  name:           effet-version:        0.1.0.0+version:        0.2.0.0 synopsis:       An Effect System based on Type Classes description:    Please see the README on GitHub at <https://github.com/typedbyte/effet#readme> category:       Control@@ -34,7 +34,6 @@       Control.Effect.Error       Control.Effect.Machinery       Control.Effect.Machinery.Default-      Control.Effect.Machinery.Kind       Control.Effect.Machinery.Tagger       Control.Effect.Machinery.TH       Control.Effect.Machinery.Via
src/Control/Effect/Cont.hs view
@@ -65,9 +65,10 @@   callCC' :: ((a -> m b) -> m a) -> m a  makeHandler ''Cont'+makeFinder  ''Cont' makeTagger  ''Cont' -instance {-# OVERLAPPABLE #-} Control (Cont' tag) t m => Cont' tag (Via eff t m) where+instance Control (Cont' tag) t m => Cont' tag (EachVia '[] t m) where   callCC' f =     liftWith       ( \run -> callCC' @tag $ \c -> run . f $
src/Control/Effect/Error.hs view
@@ -51,7 +51,7 @@ -- transformers import Control.Monad.Trans.Except (ExceptT(ExceptT), catchE, throwE) -import Control.Effect.Machinery (G, Tagger(Tagger), Via(Via), makeTaggedEffect)+import Control.Effect.Machinery  -- | An effect that equips a computation with the ability to throw and catch -- exceptions.
src/Control/Effect/Machinery.hs view
@@ -14,7 +14,6 @@ module Control.Effect.Machinery   ( -- * Re-exports from @effet@     module Control.Effect.Machinery.Default-  , module Control.Effect.Machinery.Kind   , module Control.Effect.Machinery.Tagger   , module Control.Effect.Machinery.TH   , module Control.Effect.Machinery.Via@@ -41,7 +40,6 @@ import Control.Monad.Base  import Control.Effect.Machinery.Default-import Control.Effect.Machinery.Kind import Control.Effect.Machinery.Tagger import Control.Effect.Machinery.TH import Control.Effect.Machinery.Via
− src/Control/Effect/Machinery/Kind.hs
@@ -1,68 +0,0 @@--------------------------------------------------------------------------------- |--- Module      :  Control.Effect.Machinery.Kind--- Copyright   :  (c) Michael Szvetits, 2020--- License     :  BSD3 (see the file LICENSE)--- Maintainer  :  typedbyte@qualified.name--- Stability   :  stable--- Portability :  portable------ This module defines some constraint synonyms and kinds that are used--- throughout this library, hopefully to increase the readability of the code--- at some points.-------------------------------------------------------------------------------module Control.Effect.Machinery.Kind where---- base-import Data.Kind (Constraint, Type)---- monad-control-import Control.Monad.Trans.Control (MonadTransControl)---- transformers-import Control.Monad.Trans.Class (MonadTrans)---- | The kind of monads.-type SomeMonad = Type -> Type---- | The kind of effects, which are type classes with a monad type parameter at--- the end.-type Effect = SomeMonad -> Constraint---- | The kind of monad transformers, also known as effect handlers or effect--- interpreters.-type Transformer = SomeMonad -> Type -> Type---- | This type synonym indicates that an effect is handled by a specific monad--- transformer.-type Handle (eff :: Effect) (t :: Transformer) m =-  eff (t m)---- | This constraint synonym indicates that a first-order effect is not handled--- by a specific monad transformer and must thus be delegated (\"lifted\")--- further down the monad transformer stack in order to find its associated--- handler.------ Roughly speaking, a first-order effect is a type class whose monad type--- parameter @m@ appears only in positive position when looking at the types of--- its corresponding class methods (e.g., @m@ appears only in the result type).------ An example of a first-order effect is the 'Control.Effect.State.State'' effect.-type Lift (eff :: Effect) (t :: Transformer) m =-  (eff m, Monad (t m), MonadTrans t)---- | This constraint synonym indicates that a higher-order effect is not handled--- by a specific monad transformer and must thus be delegated (\"lifted\")--- further down the monad transformer stack in order to find its associated--- handler.------ Roughly speaking, a higher-order effect is a type class whose monad type--- parameter @m@ appears in negative position when looking at the types of its--- corresponding class methods (e.g., @m@ appears in the type of a method--- parameter).------ An example of a higher-order effect is the 'Control.Effect.Reader.Reader'' effect,--- since its class method 'Control.Effect.Reader.local'' has a parameter of--- type @m a@.-type Control (eff :: Effect) (t :: Transformer) m =-  (eff m, Monad (t m), MonadTransControl t)
src/Control/Effect/Machinery/TH.hs view
@@ -15,18 +15,23 @@   ( -- * Common Generators     makeEffect   , makeHandler+  , makeFinder   , makeLifter     -- * Tag-based Generators   , makeTaggedEffect   , makeTaggedEffectWith   , makeTagger   , makeTaggerWith+    -- * Lifting Convenience+  , liftL+  , runL     -- * Naming Convention   , removeApostrophe   ) where  -- base import Control.Monad (forM, replicateM)+import Data.Coerce   (coerce) import Data.List     (isSuffixOf) import Data.Maybe    (maybeToList) @@ -40,9 +45,9 @@ -- transformers import Control.Monad.Trans.Class (lift) -import Control.Effect.Machinery.Kind   (Control, Handle, Lift) import Control.Effect.Machinery.Tagger (Tagger, runTagger)-import Control.Effect.Machinery.Via    (G, Via(Via), runVia)+import Control.Effect.Machinery.Via    (Control, EachVia, Find, G, Handle, Lift,+                                        Via, runVia)  data ClassInfo = ClassInfo   { clsCxt     :: Cxt@@ -212,6 +217,16 @@         ++ "' is not a type class, but the following instead: "         ++ show other +instanceFinderCxt :: Name -> Name -> EffectInfo -> Q Cxt+instanceFinderCxt name effs info = cxt+  [+    conT name+      `appT` effType info+      `appT` varT effs+      `appT` varT (effTrafoName info)+      `appT` tyVarType (effMonad info)+  ]+ instanceCxt :: Name -> EffectInfo -> Q Cxt instanceCxt name info = cxt   [@@ -222,11 +237,11 @@   ]  instanceHead :: Q Type -> EffectInfo -> Q Type-instanceHead eff info =+instanceHead effs info =   effType info     `appT` (-      conT ''Via-        `appT` eff+      conT ''EachVia+        `appT` effs         `appT` varT (effTrafoName info)         `appT` tyVarType (effMonad info)       )@@ -242,26 +257,42 @@ --       ... -- @ ----- @makeEffect ''MyEffect@ then generates two instances for this effect type+-- @makeEffect ''MyEffect@ then generates three instances for this effect type -- class ('Lift' for first-order effects, 'Control' for higher-order effects): -- -- @---     instance 'Handle' (MyEffect a b c) t m => MyEffect a b c ('Via' (MyEffect a b c) t m) where+--     instance 'Handle' (MyEffect a b c) t m => MyEffect a b c ('EachVia' (MyEffect a b c : effs) t m) where --       ... -----     instance {-\# OVERLAPPABLE \#-} 'Lift'/'Control' (MyEffect a b c) t m => MyEffect a b c ('Via' eff t m) where+--     instance {-\# OVERLAPPABLE \#-} 'Find' (MyEffect a b c) effs t m => MyEffect a b c ('EachVia' (other : effs) t m) where --       ...+--+--     instance 'Lift'/'Control' (MyEffect a b c) t m => MyEffect a b c ('EachVia' \'[] t m) where+--       ... -- @ ----- Without @TemplateHaskell@, you have to write these instances by hand. These--- two instances can also be generated separately, see 'makeHandler' and 'makeLifter'.+-- The first instance indicates that @MyEffect@ was found at the head of the type+-- level list of effects to be handled, so @MyEffect@ is delegated to @t@.+--+-- The second instance indicates that @MyEffect@ was not found at the head of the+-- type level list of effects to be handled, so we must find @MyEffect@ in the tail @effs@+-- of the type level list.+--+-- The third instance indicates that @MyEffect@ could not be found in the type level+-- list of effects to be handled, so the effect must be delegated further down the monad+-- transformer stack in order to find its corresponding effect handler.+--+-- Without @TemplateHaskell@, you have to write these three instances by hand. These+-- instances can also be generated separately, see 'makeHandler', 'makeFinder' and+-- 'makeLifter'. makeEffect :: Name -> Q [Dec] makeEffect className = do   clsInfo   <- classInfo className   effInfo   <- effectInfo clsInfo   hInstance <- handler effInfo+  fInstance <- finder effInfo   lInstance <- lifter effInfo-  pure [hInstance, lInstance]+  pure [hInstance, fInstance, lInstance]  -- | Similar to 'makeTaggedEffect', but only generates the tag-related definitions. makeTagger :: Name -> Q [Dec]@@ -332,9 +363,10 @@   effInfo    <- effectInfo clsInfo   tagInfo    <- taggedInfo f effInfo   hInstance  <- handler effInfo+  fInstance  <- finder effInfo   lInstance  <- lifter effInfo   taggerDecs <- tagger tagInfo-  pure (hInstance : lInstance : taggerDecs)+  pure (hInstance : fInstance : lInstance : taggerDecs)  -- | Similar to 'makeEffect', but only generates the effect type class instance -- for handling an effect.@@ -346,6 +378,17 @@   pure [hInstance]  -- | Similar to 'makeEffect', but only generates the effect type class instance+-- for finding the effect in the tail of the type level list.+--+-- @since 0.2.0.0+makeFinder :: Name -> Q [Dec]+makeFinder className = do+  clsInfo   <- classInfo className+  effInfo   <- effectInfo clsInfo+  fInstance <- finder effInfo+  pure [fInstance]++-- | Similar to 'makeEffect', but only generates the effect type class instance -- for lifting an effect. makeLifter :: Name -> Q [Dec] makeLifter className = do@@ -369,11 +412,23 @@ handler :: EffectInfo -> Q Dec handler info = do   funs <- handlerFunctions info+  effs <- newName "effs"   instanceD     ( instanceCxt ''Handle info )-    ( instanceHead (effType info) info )+    ( instanceHead (promotedConsT `appT` effType info `appT` varT effs) info )     ( fmap pure funs ) +finder :: EffectInfo -> Q Dec+finder info = do+  funs  <- finderFunctions info+  other <- newName "other"+  effs  <- newName "effs"+  instanceWithOverlapD+    ( Just Overlappable )+    ( instanceFinderCxt ''Find effs info )+    ( instanceHead (promotedConsT `appT` varT other `appT` varT effs) info )+    ( fmap pure funs )+ lifter :: EffectInfo -> Q Dec lifter info = do   let@@ -383,11 +438,9 @@       then ''Control       else ''Lift   funs <- lifterFunctions info-  eff  <- newName "eff"-  instanceWithOverlapD-    ( Just Overlappable )+  instanceD     ( instanceCxt context info )-    ( instanceHead (varT eff) info )+    ( instanceHead promotedNilT info )     ( fmap pure funs )  taggerFunctions :: TaggedInfo -> Q [Dec]@@ -505,9 +558,36 @@ handlerFunctions info =   fmap concat $     mapM-      ( function [| Via |] [| runVia |] (effMonad info) (effParams info) )+      ( function [| EachVia |] [| runVia |] (effMonad info) (effParams info) )       ( effSigs info ) +-- | Adds an effect @eff@ to the type level list of effects that need to be+-- handled by the transformer @t@. From a structural point of view, this is+-- analogous to @lift@ in the @mtl@ ecosystem. This function comes in handy+-- when writing the 'Find'-based instance of an effect by hand.+--+-- @since 0.2.0.0+liftL :: EachVia effs t m a -> EachVia (eff : effs) t m a+liftL = coerce+{-# INLINE liftL #-}++-- | Removes an effect @eff@ from the type level list of effects that need to be+-- handled by the transformer @t@. From a structural point of view, this is+-- analogous to the @run...@ functions in the @mtl@ ecosystem. This function+-- comes in handy when writing the 'Find'-based instance of an effect by hand.+--+-- @since 0.2.0.0+runL :: EachVia (eff : effs) t m a -> EachVia effs t m a+runL = coerce+{-# INLINE runL #-}++finderFunctions :: EffectInfo -> Q [Dec]+finderFunctions info =+  fmap concat $+    mapM+      ( function [| liftL |] [| runL |] (effMonad info) (effParams info) )+      ( effSigs info )+ lifterFunctions :: EffectInfo -> Q [Dec] lifterFunctions info =   let m = effMonad info@@ -543,7 +623,7 @@   let typeAppliedName = foldl appTypeE (varE funName) paramTypes       appliedExp = foldl appE expr (typeAppliedName : fmap varE fParams)       body =-        [| Via $+        [| EachVia $             (liftWith $ \ $([p|run|]) -> $appliedExp)               >>= $(traverseExp res) (restoreT . pure)         |]@@ -590,7 +670,7 @@       let rf = derive rs f inv m res           af = derive rs inv f m arg       in if elem arg rs-         then [| \x b -> $rf (((x =<<) . Via . restoreT . pure) b) |]+         then [| \x b -> $rf (((x =<<) . EachVia . restoreT . pure) b) |]          else [| \x b -> $rf (x ($af b)) |]     ForallT _ _ t ->       derive rs f inv m t
src/Control/Effect/Machinery/Via.hs view
@@ -7,20 +7,35 @@ -- Stability   :  stable -- Portability :  portable ----- This module defines the type 'Via' which indicates that a specific effect--- is handled by a specific monad transformer (also known as effect handler--- or effect interpreter).+-- This module defines the types 'EachVia' and its corresponding type synonym+-- 'Via' which indicate that specific effects are handled by a specific monad+-- transformer (also known as effect handler or effect interpreter). -- -- It also defines the 'G' type, which is the global tag that is used for -- untagged effects.+-- +-- Last but not least, it defines some constraint synonyms and kinds that are+-- used throughout this library, hopefully to increase the readability of the+-- code at some points. ----------------------------------------------------------------------------- module Control.Effect.Machinery.Via-  ( Via(..)+  ( -- * Core Types+    EachVia(..)+  , Via   , G+    -- * Constraint Synonyms and Kinds+  , SomeMonad+  , Effect+  , Transformer+  , Handle+  , Find+  , Lift+  , Control   ) where  -- base import Control.Monad.IO.Class (MonadIO)+import Data.Kind              (Constraint, Type)  -- monad-control import Control.Monad.Trans.Control (ComposeSt, MonadBaseControl,@@ -33,30 +48,36 @@ -- transformers-base import Control.Monad.Base (MonadBase, liftBase, liftBaseDefault) -import Control.Effect.Machinery.Kind (Effect, Transformer)---- | This type indicates that an effect (i.e., a type class) @eff@ is handled by+-- | This type indicates that the effects (i.e., type classes) @effs@ are handled by -- a specific monad transformer @t@. The type is a simple wrapper around the -- monad transformer itself. The whole purpose of this type is to guide the type--- system to pick the instance of type class @eff@ given by the type @t@, and--- to delegate all other effects that are not @eff@ to their handlers which are+-- system to pick the instances of type classes @effs@ given by the type @t@, and+-- to delegate all other effects that are not in @effs@ to their handlers which are -- located somewhere further down the monad transformer stack.-newtype Via (eff :: Effect) (t :: Transformer) m a =-  Via { runVia :: t m a }+--+-- @since 0.2.0.0+newtype EachVia (effs :: [Effect]) (t :: Transformer) m a =+  EachVia { runVia :: t m a }     deriving (Applicative, Functor, Monad, MonadIO)     deriving (MonadTrans, MonadTransControl) -instance (Monad (t m), MonadBase b m, MonadTrans t) => MonadBase b (Via eff t m) where+instance (Monad (t m), MonadBase b m, MonadTrans t) => MonadBase b (EachVia effs t m) where   liftBase = liftBaseDefault   {-# INLINE liftBase #-} -instance (Monad (t m), MonadBaseControl b m, MonadTransControl t) => MonadBaseControl b (Via eff t m) where-  type StM (Via eff t m) a = ComposeSt t m a+instance (Monad (t m), MonadBaseControl b m, MonadTransControl t) => MonadBaseControl b (EachVia effs t m) where+  type StM (EachVia effs t m) a = ComposeSt t m a   liftBaseWith = defaultLiftBaseWith   {-# INLINE liftBaseWith #-}   restoreM = defaultRestoreM   {-# INLINE restoreM #-} +-- | This type synonym can be used to indicate that a single effect @eff@ is+-- handled by a specific monad transformer @t@.+--+-- @since 0.2.0.0+type Via eff t m a = EachVia '[eff] t m a+ -- | This type is used as tag for all untagged effects. In order words, every -- effect is tagged, even untagged ones, but all the untagged ones simply have -- the same tag @G@ (short for \"Global\", because you can view tags as some@@ -66,3 +87,55 @@ -- If you don\'t want to use tagged effects (i.e., you write effect type classes -- without a tag type parameter), you can ignore this type completely. data G++-- | The kind of monads.+type SomeMonad = Type -> Type++-- | The kind of effects, which are type classes with a monad type parameter at+-- the end.+type Effect = SomeMonad -> Constraint++-- | The kind of monad transformers, also known as effect handlers or effect+-- interpreters.+type Transformer = SomeMonad -> Type -> Type++-- | This type synonym indicates that an effect is handled by a specific monad+-- transformer.+type Handle (eff :: Effect) (t :: Transformer) m =+  eff (t m)++-- | This type synonym indicates that an effect @eff@ is not at the head of the+-- type level list of effects to be handled, so the effect must be found further+-- down in the tail @effs@.+--+-- @since 0.2.0.0+type Find eff effs t m = (Monad (t m), eff (EachVia effs t m))++-- | This constraint synonym indicates that a first-order effect is not handled+-- by a specific monad transformer and must thus be delegated (\"lifted\")+-- further down the monad transformer stack in order to find its associated+-- handler.+--+-- Roughly speaking, a first-order effect is a type class whose monad type+-- parameter @m@ appears only in positive position when looking at the types of+-- its corresponding class methods (e.g., @m@ appears only in the result type).+--+-- An example of a first-order effect is the 'Control.Effect.State.State'' effect.+type Lift (eff :: Effect) (t :: Transformer) m =+  (eff m, Monad (t m), MonadTrans t)++-- | This constraint synonym indicates that a higher-order effect is not handled+-- by a specific monad transformer and must thus be delegated (\"lifted\")+-- further down the monad transformer stack in order to find its associated+-- handler.+--+-- Roughly speaking, a higher-order effect is a type class whose monad type+-- parameter @m@ appears in negative position when looking at the types of its+-- corresponding class methods (e.g., @m@ appears in the type of a method+-- parameter).+--+-- An example of a higher-order effect is the 'Control.Effect.Reader.Reader'' effect,+-- since its class method 'Control.Effect.Reader.local'' has a parameter of+-- type @m a@.+type Control (eff :: Effect) (t :: Transformer) m =+  (eff m, Monad (t m), MonadTransControl t)
src/Control/Effect/Map.hs view
@@ -55,7 +55,7 @@ import Data.Maybe     (isJust) import Prelude hiding (lookup) -import Control.Effect.Machinery (G, Tagger(Tagger), makeTaggedEffect)+import Control.Effect.Machinery  -- | An effect that adds a mutable collection of key-value pairs to a given computation. class Monad m => Map' tag k v m | tag m -> k v where
src/Control/Effect/RWS.hs view
@@ -16,47 +16,18 @@ ----------------------------------------------------------------------------- module Control.Effect.RWS   ( -- * Tagged RWS Effect-    RWS'(..)+    RWS'     -- * Untagged RWS Effect     -- | If you don't require disambiguation of multiple RWS effects     -- (i.e., you only have one RWS effect in your monadic context),     -- it is recommended to always use the untagged RWS effect.   , RWS-  , ask-  , local-  , tell-  , listen-  , censor-  , get-  , put-    -- * Convenience Functions-    -- ** Reader Convenience-    -- | If you don't require disambiguation of multiple RWS effects-    -- (i.e., you only have one RWS effect in your monadic context),-    -- it is recommended to always use the untagged functions.-  , asks'-  , asks-    -- ** Writer Convenience-    -- | If you don't require disambiguation of multiple RWS effects-    -- (i.e., you only have one RWS effect in your monadic context),-    -- it is recommended to always use the untagged functions.-  , listens'-  , listens-    -- ** State Convenience-    -- | If you don't require disambiguation of multiple RWS effects-    -- (i.e., you only have one RWS effect in your monadic context),-    -- it is recommended to always use the untagged functions.-  , gets'-  , gets-  , modify'-  , modify-  , modifyStrict'-  , modifyStrict     -- * Interpretations-  , Separation(..)+  , Separation   , runSeparatedRWS'   , runSeparatedRWS     -- * Tagging and Untagging+  , Tagger     -- | Conversion functions between the tagged and untagged RWS effect,     -- usually used in combination with type applications, like:     --@@ -73,145 +44,41 @@  -- base import Data.Coerce (coerce)-import Data.Tuple  (swap)  -- transformers-import qualified Control.Monad.Trans.RWS.Lazy as Lazy import qualified Control.Monad.Trans.RWS.CPS  as Strict+import qualified Control.Monad.Trans.RWS.Lazy as Lazy  import qualified Control.Effect.Reader as R import qualified Control.Effect.State  as S import qualified Control.Effect.Writer as W -import Control.Effect.Machinery+import Control.Effect.Machinery hiding (Tagger)  -- | An effect that adds the following features to a given computation: -- --     * (R) an immutable environment (the \"reader\" part) --     * (W) a write-only, accumulated output (the \"writer\" part) --     * (S) a mutable state (the \"state\" part)-class Monad m => RWS' tag r w s m | tag m -> r w s where-  -- | Gets the environment.-  ask' :: m r-  -  -- | Executes a sub-computation in a modified environment.-  local' :: (r -> r) -- ^ The function to modify the environment.-         -> m a      -- ^ The sub-computation to run in the modified environment.-         -> m a      -- ^ The result of the sub-computation.--  -- | Produces the output @w@. In other words, @w@ is appended to the accumulated output.-  tell' :: w -> m ()-  -  -- | Executes a sub-computation and appends @w@ to the accumulated output.-  listen' :: m a -> m (w, a)-  -  -- | Executes a sub-computation and applies the function to its output.-  censor' :: (w -> w) -- ^ The function which is applied to the output.-          -> m a      -- ^ The sub-computation which produces the modified output.-          -> m a      -- ^ The result of the sub-computation.-  -  -- | Gets the current state.-  get' :: m s-  -  -- | Replaces the state with a new value.-  put' :: s -> m ()--makeTaggedEffect ''RWS'--instance (Monad m, Monoid w) => RWS' tag r w s (Lazy.RWST r w s m) where-  ask' = Lazy.ask-  {-# INLINE ask' #-}-  local' = Lazy.local-  {-# INLINE local' #-}-  tell' = Lazy.tell-  {-# INLINE tell' #-}-  listen' = fmap swap . Lazy.listen-  {-# INLINE listen' #-}-  censor' = Lazy.censor-  {-# INLINE censor' #-}-  get' = Lazy.get-  {-# INLINE get' #-}-  put' = Lazy.put-  {-# INLINE put' #-}--instance (Monad m, Monoid w) => RWS' tag r w s (Strict.RWST r w s m) where-  ask' = Strict.ask-  {-# INLINE ask' #-}-  local' = Strict.local-  {-# INLINE local' #-}-  tell' = Strict.tell-  {-# INLINE tell' #-}-  listen' = fmap swap . Strict.listen-  {-# INLINE listen' #-}-  censor' = Strict.censor-  {-# INLINE censor' #-}-  get' = Strict.get-  {-# INLINE get' #-}-  put' = Strict.put-  {-# INLINE put' #-}---- | Gets a specific component of the environment, using the provided projection function.-asks' :: forall tag r w s m a. RWS' tag r w s m-      => (r -> a) -- ^ The projection function to apply to the environment.-      -> m a      -- ^ The result of the projection.-asks' = flip fmap (ask' @tag)-{-# INLINE asks' #-}---- | The untagged version of 'asks''.-asks :: RWS r w s m => (r -> a) -> m a-asks = asks' @G-{-# INLINE asks #-}---- | Executes a sub-computation and applies the function to its output, thus adding--- an additional value to the result of the sub-computation.-listens' :: forall tag r w s b m a. RWS' tag r w s m-         => (w -> b) -- ^ The function which is applied to the output.-         -> m a      -- ^ The sub-computation which produces the modified output.-         -> m (b, a) -- ^ The result of the sub-computation, including the modified output.-listens' f action = do-  ~(w, a) <- listen' @tag action-  pure (f w, a)-{-# INLINE listens' #-}---- | The untagged version of 'listens''.-listens :: RWS r w s m => (w -> b) -> m a -> m (b, a)-listens = listens' @G-{-# INLINE listens #-}---- | Gets a specific component of the state, using the provided projection function.-gets' :: forall tag r w s m a. RWS' tag r w s m => (s -> a) -> m a-gets' f = fmap f (get' @tag)-{-# INLINE gets' #-}+--+-- @since 0.2.0.0+class (R.Reader' tag r m, W.Writer' tag w m, S.State' tag s m) => RWS' tag r w s m | tag m -> r w s --- | The untagged version of 'gets''.-gets :: RWS r w s m => (s -> a) -> m a-gets f = fmap f get-{-# INLINE gets #-}+type RWS r w s = RWS' G r w s --- | Modifies the state, using the provided function.-modify' :: forall tag r w s m. RWS' tag r w s m => (s -> s) -> m ()-modify' f = do-  s <- get' @tag-  put' @tag (f s)-{-# INLINE modify' #-}+instance ( Monad (t m),+           R.Reader' tag r (EachVia effs t m),+           W.Writer' tag w (EachVia effs t m),+           S.State' tag s (EachVia effs t m)+         ) => RWS' tag r w s (EachVia (RWS' tag r w s : effs) t m) --- | The untagged version of 'modify''.-modify :: RWS r w s m => (s -> s) -> m ()-modify = modify' @G-{-# INLINE modify #-}+instance {-# OVERLAPPABLE #-}+         Find (RWS' tag r w s) effs t m => RWS' tag r w s (EachVia (other : effs) t m) --- | Modifies the state, using the provided function.--- The computation is strict in the new state.-modifyStrict' :: forall tag r w s m. RWS' tag r w s m => (s -> s) -> m ()-modifyStrict' f = do-  s <- get' @tag-  put' @tag $! f s-{-# INLINE modifyStrict' #-}+instance Control (RWS' tag r w s) t m => RWS' tag r w s (EachVia '[] t m) --- | The untagged version of 'modifyStrict''.-modifyStrict :: RWS r w s m => (s -> s) -> m ()-modifyStrict = modifyStrict' @G-{-# INLINE modifyStrict #-}+instance (Monad m, Monoid w) => RWS' tag r w s (Lazy.RWST r w s m)+instance (Monad m, Monoid w) => RWS' tag r w s (Strict.RWST r w s m)  -- | The separation interpreter of the RWS effect. This type implements the 'RWS'' -- type class by splitting the effect into separate 'R.Reader'', 'W.Writer'' and@@ -220,34 +87,76 @@ -- When interpreting the effect, you usually don\'t interact with this type directly, -- but instead use one of its corresponding interpretation functions. newtype Separation m a =-  Separation { runSeparation :: m a }+  Separation { _runSeparation :: m a }     deriving (Applicative, Functor, Monad, MonadIO)     deriving (MonadTrans, MonadTransControl) via Default     deriving (MonadBase b, MonadBaseControl b)+    deriving (R.Reader' tag r, W.Writer' tag w, S.State' tag s) -instance (R.Reader' tag r m, W.Writer' tag w m, S.State' tag s m) => RWS' tag r w s (Separation m) where-  ask' = Separation (R.ask' @tag)+instance (R.Reader' tag r m, W.Writer' tag w m, S.State' tag s m) => RWS' tag r w s (Separation m)++-- | Runs the RWS effect via separation.+runSeparatedRWS'+  :: ('[RWS' tag r w s, R.Reader' tag r, W.Writer' tag w, S.State' tag s] `EachVia` Separation) m a+  -- ^ The program whose RWS effect should be handled.+  -> m a+  -- ^ The program with its RWS effect handled.+runSeparatedRWS' = coerce+{-# INLINE runSeparatedRWS' #-}++-- | The untagged version of 'runSeparatedRWS''.+runSeparatedRWS :: ('[RWS r w s, R.Reader r, W.Writer w, S.State s] `EachVia` Separation) m a -> m a+runSeparatedRWS = coerce+{-# INLINE runSeparatedRWS #-}++-- | The tagging interpreter of the RWS effect. This type implements the+-- 'RWS'' type class by tagging\/retagging\/untagging its reader, writer and state+-- components.+--+-- When interpreting the effect, you usually don\'t interact with this type directly,+-- but instead use one of its corresponding interpretation functions.+--+-- @since 0.2.0.0+newtype Tagger tag new m a =+  Tagger { runRWSTagger :: m a }+    deriving (Applicative, Functor, Monad, MonadIO)+    deriving (MonadTrans, MonadTransControl) via Default+    deriving (MonadBase b, MonadBaseControl b)++instance RWS' new r w s m => RWS' tag r w s (Tagger tag new m)++instance RWS' new r w s m => R.Reader' tag r (Tagger tag new m) where+  ask' = Tagger (R.ask' @new)   {-# INLINE ask' #-}-  local' f = Separation . R.local' @tag f . runSeparation+  local' f m = Tagger (R.local' @new f (runRWSTagger m))   {-# INLINE local' #-}-  tell' = Separation . W.tell' @tag+  reader' f = Tagger (R.reader' @new f)+  {-# INLINE reader' #-}++instance RWS' new r w s m => W.Writer' tag w (Tagger tag new m) where+  tell' w = Tagger (W.tell' @new w)   {-# INLINE tell' #-}-  listen' = Separation . W.listen' @tag . runSeparation+  listen' m = Tagger (W.listen' @new (runRWSTagger m))   {-# INLINE listen' #-}-  censor' f = Separation . W.censor' @tag f . runSeparation+  censor' f m = Tagger (W.censor' @new f (runRWSTagger m))   {-# INLINE censor' #-}-  get' = Separation (S.get' @tag)++instance RWS' new r w s m => S.State' tag s (Tagger tag new m) where+  get' = Tagger (S.get' @new)   {-# INLINE get' #-}-  put' = Separation . S.put' @tag+  put' s = Tagger (S.put' @new s)   {-# INLINE put' #-}+  state' f = Tagger (S.state' @new f)+  {-# INLINE state' #-} --- | Runs the RWS effect via separation.-runSeparatedRWS' :: (RWS' tag r w s `Via` Separation) m a -- ^ The program whose RWS effect should be handled.-                 -> m a                                   -- ^ The program with its RWS effect handled.-runSeparatedRWS' = coerce-{-# INLINE runSeparatedRWS' #-}+tagRWS' :: forall new r w s m a. ('[RWS' G r w s, R.Reader' G r, W.Writer' G w, S.State' G s] `EachVia` Tagger G new) m a -> m a+tagRWS' = coerce+{-# INLINE tagRWS' #-} --- | The untagged version of 'runSeparatedRWS''.-runSeparatedRWS :: (RWS r w s `Via` Separation) m a -> m a-runSeparatedRWS = coerce-{-# INLINE runSeparatedRWS #-}+retagRWS' :: forall tag new r w s m a. ('[RWS' tag r w s, R.Reader' tag r, W.Writer' tag w, S.State' tag s] `EachVia` Tagger tag new) m a -> m a+retagRWS' = coerce+{-# INLINE retagRWS' #-}++untagRWS' :: forall tag r w s m a. ('[RWS' tag r w s, R.Reader' tag r, W.Writer' tag w, S.State' tag s] `EachVia` Tagger tag G) m a -> m a+untagRWS' = coerce+{-# INLINE untagRWS' #-}
src/Control/Effect/RWS/Lazy.hs view
@@ -27,56 +27,75 @@ -- transformers import Control.Monad.Trans.RWS.Lazy (RWST, runRWST) -import Control.Effect.Machinery (G, Via, runVia)+import Control.Effect.Machinery (EachVia, G, runVia)+import Control.Effect.Reader    (Reader, Reader') import Control.Effect.RWS       (RWS, RWS')+import Control.Effect.State     (State, State')+import Control.Effect.Writer    (Writer, Writer')  -- | Runs the RWS effect and discards the final state.-evalRWS' :: forall tag r w s m a. Functor m-         => r                                     -- ^ The initial environment.-         -> s                                     -- ^ The initial state.-         -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-         -> m (w, a)                              -- ^ The program with its RWS effect handled, producing the final-                                                  -- output @w@ and the result @a@.+evalRWS'+  :: forall tag r w s m a. Functor m+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, a)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@ and the result @a@. evalRWS' r s = fmap reorder . (\m -> runRWST m r s) . runVia   where     reorder (a, _, w) = (w, a) {-# INLINE evalRWS' #-}  -- | The untagged version of 'evalRWS''.-evalRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, a)+evalRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a) evalRWS = evalRWS' @G {-# INLINE evalRWS #-}  -- | Runs the RWS effect and discards the result of the interpreted program.-execRWS' :: forall tag r w s m a. Functor m-         => r                                     -- ^ The initial environment.-         -> s                                     -- ^ The initial state.-         -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-         -> m (w, s)                              -- ^ The program with its RWS effect handled, producing the final-                                                  -- output @w@ and the final state @s@.+execRWS'+  :: forall tag r w s m a. Functor m+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, s)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@ and the final state @s@. execRWS' r s = fmap reorder . (\m -> runRWST m r s) . runVia   where     reorder (_, s', w) = (w, s') {-# INLINE execRWS' #-}  -- | The untagged version of 'execRWS''.-execRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s)+execRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s) execRWS = execRWS' @G {-# INLINE execRWS #-} --- | Runs the RWS effect and returns the final output, the final state and the result of the interpreted program.-runRWS' :: forall tag r w s m a. Functor m-        => r                                     -- ^ The initial environment.-        -> s                                     -- ^ The initial state.-        -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-        -> m (w, s, a)                           -- ^ The program with its RWS effect handled, producing the final-                                                 -- output @w@, the final state @s@ and the result @a@.+-- | Runs the RWS effect and returns the final output, the final state and the+-- result of the interpreted program.+runRWS'+  :: forall tag r w s m a. Functor m+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, s, a)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@, the final state @s@ and the result @a@. runRWS' r s = fmap reorder . (\m -> runRWST m r s) . runVia   where     reorder (a, s', w) = (w, s', a) {-# INLINE runRWS' #-}  -- | The untagged version of 'runRWS''.-runRWS :: Functor m => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s, a)+runRWS :: Functor m => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a) runRWS = runRWS' @G {-# INLINE runRWS #-}
src/Control/Effect/RWS/Strict.hs view
@@ -34,7 +34,10 @@ import qualified Control.Monad.Trans.RWS.CPS as RWS  import Control.Effect.Machinery-import Control.Effect.RWS (RWS, RWS')+import Control.Effect.Reader    (Reader, Reader')+import Control.Effect.RWS       (RWS, RWS')+import Control.Effect.State     (State, State')+import Control.Effect.Writer    (Writer, Writer')  -- This is necessary until the writer CPS instances land in monad-control. -- See: https://github.com/basvandijk/monad-control/pull/51@@ -47,7 +50,7 @@   RWST { runRWST :: RWS.RWST r w s m a }     deriving (Applicative, Functor, Monad, MonadIO)     deriving (MonadTrans)-    deriving (RWS' tag r w s)+    deriving (RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s)  instance MonadBase b m => MonadBase b (RWST r w s m) where   liftBase = liftBaseDefault@@ -70,52 +73,67 @@   {-# INLINABLE restoreT #-}  -- | Runs the RWS effect and discards the final state.-evalRWS' :: forall tag r w s m a. (Functor m, Monoid w)-         => r                                     -- ^ The initial environment.-         -> s                                     -- ^ The initial state.-         -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-         -> m (w, a)                              -- ^ The program with its RWS effect handled, producing the final-                                                  -- output @w@ and the result @a@.+evalRWS'+  :: forall tag r w s m a. (Functor m, Monoid w)+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, a)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@ and the result @a@. evalRWS' r s = fmap reorder . (\m -> RWS.runRWST m r s) . coerce   where     reorder (a, _, w) = (w, a) {-# INLINE evalRWS' #-}  -- | The untagged version of 'evalRWS''.-evalRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, a)+evalRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, a) evalRWS = evalRWS' @G {-# INLINE evalRWS #-}  -- | Runs the RWS effect and discards the result of the interpreted program.-execRWS' :: forall tag r w s m a. (Functor m, Monoid w)-         => r                                     -- ^ The initial environment.-         -> s                                     -- ^ The initial state.-         -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-         -> m (w, s)                              -- ^ The program with its RWS effect handled, producing the final-                                                  -- output @w@ and the final state @s@.+execRWS'+  :: forall tag r w s m a. (Functor m, Monoid w)+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, s)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@ and the final state @s@. execRWS' r s = fmap reorder . (\m -> RWS.runRWST m r s) . coerce   where     reorder (_, s', w) = (w, s') {-# INLINE execRWS' #-}  -- | The untagged version of 'execRWS''.-execRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s)+execRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s) execRWS = execRWS' @G {-# INLINE execRWS #-}  -- | Runs the RWS effect and returns the final output, the final state and the result of the interpreted program.-runRWS' :: forall tag r w s m a. (Functor m, Monoid w)-        => r                                     -- ^ The initial environment.-        -> s                                     -- ^ The initial state.-        -> (RWS' tag r w s `Via` RWST r w s) m a -- ^ The program whose RWS effect should be handled.-        -> m (w, s, a)                           -- ^ The program with its RWS effect handled, producing the final-                                                 -- output @w@, the final state @s@ and the result @a@.+runRWS'+  :: forall tag r w s m a. (Functor m, Monoid w)+  => r+  -- ^ The initial environment.+  -> s+  -- ^ The initial state.+  -> ('[RWS' tag r w s, Reader' tag r, Writer' tag w, State' tag s] `EachVia` RWST r w s) m a+  -- ^ The program whose RWS effect should be handled.+  -> m (w, s, a)+  -- ^ The program with its RWS effect handled, producing the final+  -- output @w@, the final state @s@ and the result @a@. runRWS' r s = fmap reorder . (\m -> RWS.runRWST m r s) . coerce   where     reorder (a, s', w) = (w, s', a) {-# INLINE runRWS' #-}  -- | The untagged version of 'runRWS''.-runRWS :: (Functor m, Monoid w) => r -> s -> (RWS r w s `Via` RWST r w s) m a -> m (w, s, a)+runRWS :: (Functor m, Monoid w) => r -> s -> ('[RWS r w s, Reader r, Writer w, State s] `EachVia` RWST r w s) m a -> m (w, s, a) runRWS = runRWS' @G {-# INLINE runRWS #-}
src/Control/Effect/Reader.hs view
@@ -47,9 +47,11 @@   ) where  -- transformers-import qualified Control.Monad.Trans.Reader as R+import qualified Control.Monad.Trans.Reader   as R+import qualified Control.Monad.Trans.RWS.CPS  as Strict+import qualified Control.Monad.Trans.RWS.Lazy as Lazy -import Control.Effect.Machinery (G, Tagger(Tagger), Via, makeTaggedEffect, runVia)+import Control.Effect.Machinery  -- | An effect that adds an immutable state (i.e., an \"environment\") to a given -- computation. The effect allows to read values from the environment, pass values@@ -83,6 +85,22 @@   local' = R.local   {-# INLINE local' #-}   reader' = R.reader+  {-# INLINE reader' #-}++instance (Monad m, Monoid w) => Reader' tag r (Lazy.RWST r w s m) where+  ask' = Lazy.ask+  {-# INLINE ask' #-}+  local' = Lazy.local+  {-# INLINE local' #-}+  reader' = Lazy.reader+  {-# INLINE reader' #-}++instance Monad m => Reader' tag r (Strict.RWST r w s m) where+  ask' = Strict.ask+  {-# INLINE ask' #-}+  local' = Strict.local+  {-# INLINE local' #-}+  reader' = Strict.reader   {-# INLINE reader' #-}  -- | Gets a specific component of the environment, using the provided projection function.
src/Control/Effect/State.hs view
@@ -54,10 +54,12 @@ import Data.Tuple (swap)  -- transformers+import qualified Control.Monad.Trans.RWS.CPS      as Strict+import qualified Control.Monad.Trans.RWS.Lazy     as Lazy import qualified Control.Monad.Trans.State.Lazy   as L import qualified Control.Monad.Trans.State.Strict as S -import Control.Effect.Machinery (G, Tagger(Tagger), makeTaggedEffect)+import Control.Effect.Machinery  -- | An effect that adds a mutable state to a given computation. class Monad m => State' tag s m | tag m -> s where@@ -98,6 +100,22 @@   put' = S.put   {-# INLINE put' #-}   state' = S.state . fmap swap+  {-# INLINE state' #-}++instance (Monad m, Monoid w) => State' tag s (Lazy.RWST r w s m) where+  get' = Lazy.get+  {-# INLINE get' #-}+  put' = Lazy.put+  {-# INLINE put' #-}+  state' = Lazy.state . fmap swap+  {-# INLINE state' #-}++instance Monad m => State' tag s (Strict.RWST r w s m) where+  get' = Strict.get+  {-# INLINE get' #-}+  put' = Strict.put+  {-# INLINE put' #-}+  state' = Strict.state . fmap swap   {-# INLINE state' #-}  -- | Gets a specific component of the state, using the provided projection function.
src/Control/Effect/Writer.hs view
@@ -50,10 +50,12 @@ import Data.Tuple (swap)  -- transformers+import qualified Control.Monad.Trans.RWS.CPS     as Strict+import qualified Control.Monad.Trans.RWS.Lazy    as Lazy import qualified Control.Monad.Trans.Writer.Lazy as L import qualified Control.Monad.Trans.Writer.CPS  as S -import Control.Effect.Machinery (G, Tagger(Tagger), makeTaggedEffect)+import Control.Effect.Machinery  -- | An effect that adds a write-only, accumulated output to a given computation. class Monad m => Writer' tag w m | tag m -> w where@@ -82,6 +84,22 @@   listen' = fmap swap . S.listen   {-# INLINE listen' #-}   censor' = S.censor+  {-# INLINE censor' #-}++instance (Monad m, Monoid w) => Writer' tag w (Lazy.RWST r w s m) where+  tell' = Lazy.tell+  {-# INLINE tell' #-}+  listen' = fmap swap . Lazy.listen+  {-# INLINE listen' #-}+  censor' = Lazy.censor+  {-# INLINE censor' #-}++instance (Monad m, Monoid w) => Writer' tag w (Strict.RWST r w s m) where+  tell' = Strict.tell+  {-# INLINE tell' #-}+  listen' = fmap swap . Strict.listen+  {-# INLINE listen' #-}+  censor' = Strict.censor   {-# INLINE censor' #-}  -- | Executes a sub-computation and applies the function to its output, thus adding