This repository was archived by the owner on Oct 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -14,3 +14,4 @@ bower install purescript-eff
1414
1515- [ Control.Monad.Eff] ( docs/Control.Monad.Eff.md )
1616- [ Control.Monad.Eff.Unsafe] ( docs/Control.Monad.Eff.Unsafe.md )
17+ - [ Control.Monad.Eff.Class] ( docs/Control.Monad.Eff.Class.md )
Original file line number Diff line number Diff line change 1+ ## Module Control.Monad.Eff.Class
2+
3+ #### ` MonadEff `
4+
5+ ``` purescript
6+ class (Monad m) <= MonadEff eff m where
7+ liftEff :: forall a. Eff eff a -> m a
8+ ```
9+
10+ The ` MonadEff ` class captures those monads which support native effects.
11+
12+ Instances are provided for ` Eff ` itself, and the standard monad transformers.
13+
14+ ` liftEff ` can be used in any appropriate monad transformer stack to lift an action
15+ of type ` Eff eff a ` into the monad.
16+
17+ Note that ` MonadEff ` is parameterized by the row of effects, so type inference can be
18+ tricky. It is generally recommended to either work with a polymorphic row of effects,
19+ or a concrete, closed row of effects such as ` (trace :: Trace) ` .
20+
21+ ##### Instances
22+ ``` purescript
23+ instance monadEffEff :: MonadEff eff (Eff eff)
24+ ```
25+
26+
Original file line number Diff line number Diff line change 1+ module Control.Monad.Eff.Class
2+ ( MonadEff
3+ , liftEff
4+ ) where
5+
6+ import Prelude
7+
8+ import Control.Monad.Eff
9+
10+ -- | The `MonadEff` class captures those monads which support native effects.
11+ -- |
12+ -- | Instances are provided for `Eff` itself, and the standard monad transformers.
13+ -- |
14+ -- | `liftEff` can be used in any appropriate monad transformer stack to lift an action
15+ -- | of type `Eff eff a` into the monad.
16+ -- |
17+ -- | Note that `MonadEff` is parameterized by the row of effects, so type inference can be
18+ -- | tricky. It is generally recommended to either work with a polymorphic row of effects,
19+ -- | or a concrete, closed row of effects such as `(trace :: Trace)`.
20+ class (Monad m ) <= MonadEff eff m where
21+ liftEff :: forall a . Eff eff a -> m a
22+
23+ instance monadEffEff :: MonadEff eff (Eff eff ) where
24+ liftEff = id
You can’t perform that action at this time.
0 commit comments