packages feed

polysemy-methodology 0.1.4.0 → 0.1.5.0

raw patch · 3 files changed

+16/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Polysemy.Methodology: mconcatMethodology :: forall f b c r a. (Members '[Methodology b c] r, Monoid c, Traversable f) => Sem (Methodology (f b) c : r) a -> Sem r a

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for polysemy-methodology +## v0.1.5.0++* Add `mconcatMethodology`.+ ## v0.1.4.0  * Add `logMethodologyStart`, `logMethodologyEnd` and `logMethodologyAround`
polysemy-methodology.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-methodology-version:        0.1.4.0+version:        0.1.5.0 synopsis:       Domain modelling algebra for polysemy category:       Polysemy author:         Daniel Firth
src/Polysemy/Methodology.hs view
@@ -28,7 +28,7 @@ makeSem ''Methodology  -- | Run a `Methodology` using a pure function.-runMethodologyPure :: forall b c r a. (b -> c) -> Sem (Methodology b c ': r) a -> Sem r a +runMethodologyPure :: forall b c r a. (b -> c) -> Sem (Methodology b c ': r) a -> Sem r a runMethodologyPure f = interpret \case   Process b -> return $ f b @@ -122,7 +122,7 @@ runMethodologyAsKVStoreWithDefault d = interpret \case   Process k -> do     z <- lookupKV k-    case z of +    case z of       Just a -> return a       Nothing -> return d @@ -229,6 +229,15 @@                        -> Sem r a traceMethodologyStart f = intercept \case   Process b -> trace (f b) >> process @b @c b++-- | Run a `Methodology` concatenating the results as a monoid.+mconcatMethodology :: forall f b c r a.+                      ( Members '[Methodology b c] r+                      , Monoid c, Traversable f)+                   => Sem (Methodology (f b) c ': r) a+                   -> Sem r a+mconcatMethodology = interpret \case+  Process b -> traverse (process @b @c) b >>= return . foldr (<>) mempty  -- | `Trace` a `String` based on the output to a `Methodology`. traceMethodologyEnd :: forall b c r a.