mirror of
https://github.com/coot/free-category.git
synced 2024-11-22 16:22:05 +03:00
Add runEffCat (#33)
Co-authored-by: Manuel Bärenz <m.baerenz@sonnen.de> Co-authored-by: Marcin Szamotulski <profunctor@pm.me>
This commit is contained in:
parent
b4a67b3489
commit
f6eb1fae64
@ -12,6 +12,7 @@ module Control.Category.FreeEffect
|
||||
, EffCat (..)
|
||||
, liftEffect
|
||||
, foldNatEffCat
|
||||
, runEffCat
|
||||
, liftKleisli
|
||||
) where
|
||||
|
||||
@ -89,6 +90,15 @@ foldNatEffCat
|
||||
-> c a b
|
||||
foldNatEffCat nat = foldNatFree2 (foldNatFree2 nat)
|
||||
|
||||
-- | Join all effects in a free effectful category 'EffCat'.
|
||||
--
|
||||
runEffCat
|
||||
:: Monad m
|
||||
=> EffCat m c a b
|
||||
-> m (c a b)
|
||||
runEffCat (Base f) = return f
|
||||
runEffCat (Effect mf) = runEffCat =<< mf
|
||||
|
||||
-- | Functor from @(->)@ category to @'Kleisli' m@. If @m@ is 'Identity' then
|
||||
-- it will respect 'effect' i.e.
|
||||
-- @'liftKleisli' ('effect' ar) = 'effect' ('liftKleisli' \<$\> ar)@.
|
||||
|
Loading…
Reference in New Issue
Block a user