packages feed

polysemy-keyed-state 0.1 → 0.1.1

raw patch · 3 files changed

+20/−2 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Polysemy.State.Keyed: zoomAt :: forall k a r. Member (KeyedState k) r => k a -> InterpreterFor (State a) r
- Polysemy.State.Keyed: getAt :: forall k_a7xv r_a91C a_a7xw. MemberWithError (KeyedState k_a7xv) r_a91C => k_a7xv a_a7xw -> Sem r_a91C a_a7xw
+ Polysemy.State.Keyed: getAt :: forall k_a7xD r_a91K a_a7xE. MemberWithError (KeyedState k_a7xD) r_a91K => k_a7xD a_a7xE -> Sem r_a91K a_a7xE
- Polysemy.State.Keyed: putAt :: forall k_a7xy r_a91E a_X7xA. MemberWithError (KeyedState k_a7xy) r_a91E => k_a7xy a_X7xA -> a_X7xA -> Sem r_a91E ()
+ Polysemy.State.Keyed: putAt :: forall k_a7xG r_a91M a_X7xI. MemberWithError (KeyedState k_a7xG) r_a91M => k_a7xG a_X7xI -> a_X7xI -> Sem r_a91M ()

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+0.1.1+-----+* Added `zoomAt`.+ 0.1 --- Initial release.
polysemy-keyed-state.cabal view
@@ -5,10 +5,11 @@ -- see: https://github.com/sol/hpack  name:           polysemy-keyed-state-version:        0.1+version:        0.1.1 synopsis:       Effect for a set of stateful values indexed by a type of keys description:    The @KeyedState k@ effect provides access to a set of stateful values indexed by some key type @k :: Type -> Type@, where a key of type @k a@ can be used to access a stateful value of type @a@. category:       BSD3, Library+stability:      experimental homepage:       https://github.com/kcsmnt0/polysemy-keyed-state#readme bug-reports:    https://github.com/kcsmnt0/polysemy-keyed-state/issues maintainer:     Katie Casamento <kcsmnt0@gmail.com>@@ -16,7 +17,9 @@ license-file:   LICENSE build-type:     Simple tested-with:-    GHC == 8.10.5+    GHC == 8.6.5+  , GHC == 8.8.4+  , GHC == 8.10.5 extra-source-files:     README.md     CHANGELOG.md
src/Polysemy/State/Keyed.hs view
@@ -5,6 +5,7 @@   , putAt   , modifyAt   , rename+  , zoomAt   -- * @State@ interpreters   , runKeyedStates   , KeyedStore(..)@@ -65,6 +66,16 @@   transform $ \case     GetAt k -> GetAt $ h k     PutAt k x -> PutAt (h k) x++-- |Interpret a @State@ effect as a single variable in a @KeyedState@ effect.+zoomAt ::+  forall k a r.+  Member (KeyedState k) r =>+  k a -> InterpreterFor (State a) r+zoomAt k =+  interpret $ \case+    Get -> getAt k+    Put x -> putAt k x  {-| Distribute a @KeyedState@ effect across multiple @State@ effects by mapping each key to an effect.