1
1
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:
Manuel Bärenz 2020-10-19 20:11:52 +02:00 committed by GitHub
parent b4a67b3489
commit f6eb1fae64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)@.