mirror of
https://github.com/lexi-lambda/freer-simple.git
synced 2024-12-24 14:43:57 +03:00
Coding style and documentation for runNat{,S}
This commit is contained in:
parent
5eaff723a0
commit
a872d81981
@ -42,24 +42,26 @@ module Control.Monad.Freer
|
||||
|
||||
import Control.Applicative (pure)
|
||||
import Control.Monad ((>>=))
|
||||
import Data.Function ((.), const)
|
||||
import Data.Function (($), (.), const)
|
||||
import Data.Tuple (uncurry)
|
||||
|
||||
import Control.Monad.Freer.Internal
|
||||
|
||||
|
||||
-- | Variant of 'handleRelay' simplified for the common case.
|
||||
runNat
|
||||
:: Member m effs
|
||||
=> (forall a. eff a -> m a)
|
||||
-> Eff (eff ': effs) b
|
||||
-> Eff effs b
|
||||
runNat f = handleRelay pure (\b -> (send (f b) >>=))
|
||||
runNat f = handleRelay pure $ \e -> (send (f e) >>=)
|
||||
|
||||
-- | Variant of 'handleRelayS' simplified for the common case.
|
||||
runNatS
|
||||
:: Member m effs
|
||||
=> s
|
||||
-> (forall a. s -> eff a -> m (s, a))
|
||||
-> Eff (eff ': effs) w
|
||||
-> Eff effs w
|
||||
-> Eff (eff ': effs) b
|
||||
-> Eff effs b
|
||||
runNatS s0 f =
|
||||
handleRelayS s0 (const pure) (\s v -> (send (f s v) >>=) . uncurry)
|
||||
handleRelayS s0 (const pure) $ \s e -> (send (f s e) >>=) . uncurry
|
||||
|
Loading…
Reference in New Issue
Block a user