packages feed

polysemy-methodology 0.1.3.2 → 0.1.4.0

raw patch · 4 files changed

+57/−1 lines, 4 filesdep +co-log-polysemyPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: co-log-polysemy

API changes (from Hackage documentation)

+ Polysemy.Methodology: logMethodologyAround :: forall b c p q r a. Members '[Methodology b c, Log p, Log q] r => (b -> p) -> (c -> q) -> Sem r a -> Sem r a
+ Polysemy.Methodology: logMethodologyEnd :: forall b c q r a. Members '[Methodology b c, Log q] r => (c -> q) -> Sem r a -> Sem r a
+ Polysemy.Methodology: logMethodologyStart :: forall b c p r a. Members '[Methodology b c, Log p] r => (b -> p) -> Sem r a -> Sem r a
- Polysemy.Methodology: process :: forall b_ab3J c_ab3K r_aclx. MemberWithError (Methodology b_ab3J c_ab3K) r_aclx => b_ab3J -> Sem r_aclx c_ab3K
+ Polysemy.Methodology: process :: forall b_ab51 c_ab52 r_acmP. MemberWithError (Methodology b_ab51 c_ab52) r_acmP => b_ab51 -> Sem r_acmP c_ab52

Files

ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for polysemy-methodology +## v0.1.4.0++* Add `logMethodologyStart`, `logMethodologyEnd` and `logMethodologyAround`++## v0.1.3.0++* Add `traceMethodologyStart`, `traceMethodologyEnd` and `traceMethodologyAround`+ ## v0.1.2.0  * Add `fmapMethodology`, `fmapMethodology2`, `bindMethodology` and `traverseMethodology`.
README.md view
@@ -200,6 +200,12 @@ it.  ```+type DeckSplit = '[[Config.MinimalReversedCard]+                 , [Config.BasicReversedCard]+                 , [Config.ExcerptSpec]+                 , [Config.PronunciationSpec]+                 ]+ main = do   forM_ decks $ \x -> do     flashblast @Config.Deck @Deck
polysemy-methodology.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-methodology-version:        0.1.3.2+version:        0.1.4.0 synopsis:       Domain modelling algebra for polysemy category:       Polysemy author:         Daniel Firth@@ -32,6 +32,7 @@   ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints   build-depends:       base >=4.7 && <5+    , co-log-polysemy     , polysemy     , polysemy-plugin     , polysemy-zoo
src/Polysemy/Methodology.hs view
@@ -13,6 +13,7 @@ module Polysemy.Methodology where  import Control.Monad+import Colog.Polysemy as C import Polysemy import Polysemy.KVStore import Polysemy.Input@@ -255,4 +256,44 @@     trace $ f b     c <- process @b @c b     trace $ g c+    return c++-- | `Log` a type based on the input to a `Methodology`.+logMethodologyStart :: forall b c p r a.+                       Members '[Methodology b c,+                                 Log p] r+                       => (b -> p)+                       -> Sem r a+                       -> Sem r a+logMethodologyStart f = intercept \case+  Process b -> C.log (f b) >> process @b @c b+++-- | `Log` a type based on the output to a `Methodology`.+logMethodologyEnd :: forall b c q r a.+                       Members '[Methodology b c,+                                Log q] r+                       => (c -> q)+                       -> Sem r a+                       -> Sem r a+logMethodologyEnd f = intercept \case+  Process b -> do+    c <- process @b @c b+    C.log $ f c+    return c++-- | `Log` both the start and the end of a `Methodology`.+logMethodologyAround :: forall b c p q r a.+                           Members '[Methodology b c,+                                     Log p+                                    , Log q] r+                       => (b -> p)+                       -> (c -> q)+                       -> Sem r a+                       -> Sem r a+logMethodologyAround f g = intercept \case+  Process b -> do+    C.log $ f b+    c <- process @b @c b+    C.log $ g c     return c