packages feed

polysemy-methodology 0.1.7.0 → 0.1.8.0

raw patch · 3 files changed

+36/−3 lines, 3 filesdep ~polysemydep ~polysemy-zooPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: polysemy, polysemy-zoo

API changes (from Hackage documentation)

+ Polysemy.Methodology: runMethodologyMappendPure :: forall b c r a. (Monoid c, Members '[Methodology b c] r) => (b -> c) -> Sem r a -> Sem r a
+ Polysemy.Methodology: runMethodologyMappendSem :: forall b c r a. (Monoid c, Members '[Methodology b c] r) => (b -> Sem r c) -> Sem r a -> Sem r a
- Polysemy.Methodology: process :: forall b_ab7w c_ab7x r_acpk. MemberWithError (Methodology b_ab7w c_ab7x) r_acpk => b_ab7w -> Sem r_acpk c_ab7x
+ Polysemy.Methodology: process :: forall b_ab9B c_ab9C r_acrp. MemberWithError (Methodology b_ab9B c_ab9C) r_acrp => b_ab9B -> Sem r_acrp c_ab9C

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for polysemy-methodology +## v0.1.8.0++* Add `runMethodologyMappendPure` and `runMethodologyMappendSem`.+ ## v0.1.7.0  * Add `pureMethodology` and `pureMethodology'`.
polysemy-methodology.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-methodology-version:        0.1.7.0+version:        0.1.8.0 synopsis:       Domain modelling algebra for polysemy category:       Polysemy author:         Daniel Firth@@ -33,7 +33,7 @@   build-depends:       base >=4.7 && <5     , co-log-polysemy-    , polysemy+    , polysemy >=1.3.0.0 && <1.5     , polysemy-plugin-    , polysemy-zoo+    , polysemy-zoo >=0.7.0.1 && <0.8   default-language: Haskell2010
src/Polysemy/Methodology.hs view
@@ -62,6 +62,8 @@ , plugMethodologyInput , runMethodologyAsKVStore , runMethodologyAsKVStoreWithDefault+, runMethodologyMappendPure+, runMethodologyMappendSem  -- * Tracing , traceMethodologyStart@@ -74,6 +76,7 @@ , logMethodologyAround ) where +import Control.Applicative import Control.Arrow import Control.Monad import Colog.Polysemy as C@@ -282,6 +285,32 @@       Just a -> return a       Nothing -> return d {-# INLINE runMethodologyAsKVStoreWithDefault #-}++-- | Run a `Methodology` targetting a `Monoid` without consuming it, pure version. This should probably be considered an+-- anti-pattern, and it's probably better to decompose the inputs fully, but is otherwise sound.+--+-- @since 0.1.8.0+runMethodologyMappendPure :: forall b c r a.+                             (Monoid c,+                             Members '[Methodology b c] r)+                          => (b -> c)+                          -> Sem r a -> Sem r a+runMethodologyMappendPure f = intercept \case+  Process b -> (f b <>) <$> process @b @c b+{-# INLINE runMethodologyMappendPure #-}++-- | Run a `Methodology` targetting a `Monoid` without consuming it, `Sem` version. This should probably be considered an+-- anti-pattern, and it's probably better to decompose the inputs fully, but is otherwise sound.+--+-- @since 0.1.8.0+runMethodologyMappendSem :: forall b c r a.+                            (Monoid c,+                            Members '[Methodology b c] r)+                          => (b -> Sem r c)+                          -> Sem r a -> Sem r a+runMethodologyMappendSem f = intercept \case+  Process b -> liftA2 (<>) (f b) (process @b @c b)+{-# INLINE runMethodologyMappendSem #-}  -- | Decompose a `Methodology` into several components to be recombined. This is `cutMethodology` specialised to `HList`. --