packages feed

fused-effects-lens 1.0.0.0 → 1.1.0.0

raw patch · 3 files changed

+33/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Effect.Lens: (*=) :: forall s a sig m. (Has (State s) sig m, Num a) => ASetter' s a -> a -> m ()
+ Control.Effect.Lens: (+=) :: forall s a sig m. (Has (State s) sig m, Num a) => ASetter' s a -> a -> m ()
+ Control.Effect.Lens: (-=) :: forall s a sig m. (Has (State s) sig m, Num a) => ASetter' s a -> a -> m ()
+ Control.Effect.Lens: (//=) :: forall s a sig m. (Has (State s) sig m, Fractional a) => ASetter' s a -> a -> m ()
+ Control.Effect.Lens: infix 4 //=
- Control.Effect.Lens: infixr 4 %=
+ Control.Effect.Lens: infixr 4 .=

Files

CHANGES.md view
@@ -1,3 +1,8 @@+# v1.1.0.0++Introduce `+=`, `-=`, `*=`, and `//=`.+Change fixity of `%=` to `infix` rather than `infixr`.+ # v1.0.0.0  Upgrade to fused-effects v1.
fused-effects-lens.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.4  name:                fused-effects-lens-version:             1.0.0.0+version:             1.1.0.0 synopsis:            Monadic lens combinators for fused-effects. description:         Provides combinators for the lens-based manipulation of state and context types provided by the fused-effects library, similar to those provided for mtl-based monad transformers. homepage:            https://github.com/fused-effects/fused-effects-lens#readme
src/Control/Effect/Lens.hs view
@@ -11,6 +11,10 @@   , (.=)   , modifying   , (%=)+  , (+=)+  , (-=)+  , (*=)+  , (//=)   ) where  import Control.Algebra@@ -18,7 +22,6 @@ import Control.Effect.State as State import Lens.Micro as Lens import Lens.Micro.Extras as Lens-import Lens.Micro.Type (ASetter, Getting)  -- | View the value pointed to by a @Getter@, 'Lens', 'Traversal', or -- @Fold@ corresponding to the 'Reader' context of the given monadic@@ -77,11 +80,33 @@ modifying l f = State.modify (Lens.over l f) {-# INLINE modifying #-} +infix 4 %=, +=, -=, *=, //=+ -- | Map over the target of a 'Lens', or all of the targets of a @Setter@ -- or 'Traversal', in the current monadic state. -- -- This is an infix version of 'modifying'.-infixr 4 %= (%=) :: forall s a b sig m . (Has (State.State s) sig m) => ASetter s s a b -> (a -> b) -> m () (%=) = modifying {-# INLINE (%=) #-}++-- | Modify the target(s) of a 'Lens', @Iso@, @Setter@ or 'Traversal' by adding a value.+(+=) :: forall s a sig m . (Has (State.State s) sig m, Num a) => ASetter' s a -> a -> m ()+l += v = State.modify (l +~ v)+{-# INLINE (+=) #-}++-- | Modify the target(s) of a 'Lens', @Iso@, @Setter@ or 'Traversal' by subtracting a value.+(-=) :: forall s a sig m . (Has (State.State s) sig m, Num a) => ASetter' s a -> a -> m ()+l -= v = State.modify (l -~ v)+{-# INLINE (-=) #-}++-- | Modify the target(s) of a 'Lens', @Iso@, @Setter@ or 'Traversal' by subtracting a value.+(*=) :: forall s a sig m . (Has (State.State s) sig m, Num a) => ASetter' s a -> a -> m ()+l *= v = modifying l (* v)+{-# INLINE (*=) #-}++-- | Modify the target(s) of a 'Lens', @Iso@, @Setter@ or 'Traversal' by dividing a value.+(//=) :: forall s a sig m . (Has (State.State s) sig m, Fractional a) => ASetter' s a -> a -> m ()+l //= v = modifying l (/ v)+{-# INLINE (//=) #-}+