mirror of
https://github.com/lexi-lambda/freer-simple.git
synced 2024-12-23 14:12:45 +03:00
add raise
This commit is contained in:
parent
84762417b7
commit
9f6ff9f67d
@ -22,6 +22,9 @@ module Control.Monad.Freer
|
||||
-- ** Sending Arbitrary Effect
|
||||
, send
|
||||
|
||||
-- ** Lifting Effect Stacks
|
||||
, raise
|
||||
|
||||
-- * Handling Effects
|
||||
, Arr
|
||||
, run
|
||||
@ -47,6 +50,7 @@ import Control.Monad.Freer.Internal
|
||||
, Members
|
||||
, handleRelay
|
||||
, handleRelayS
|
||||
, raise
|
||||
, run
|
||||
, runM
|
||||
, send
|
||||
|
@ -53,6 +53,9 @@ module Control.Monad.Freer.Internal
|
||||
-- ** Sending Arbitrary Effect
|
||||
, send
|
||||
|
||||
-- ** Lifting Effect Stacks
|
||||
, raise
|
||||
|
||||
-- * Handling Effects
|
||||
, run
|
||||
, runM
|
||||
@ -268,6 +271,14 @@ interpose ret h = loop
|
||||
where
|
||||
k = qComp q loop
|
||||
|
||||
-- | Embeds a less-constrained 'Eff' into a more-constrained one. Analogous to
|
||||
-- MTL's 'lift'.
|
||||
raise :: Eff effs a -> Eff (e ': effs) a
|
||||
raise = loop
|
||||
where
|
||||
loop (Val x) = pure x
|
||||
loop (E u q) = E (weaken u) . tsingleton $ qComp q loop
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Nondeterministic Choice --
|
||||
--------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user