microlens-mtl 0.1.9.0 → 0.1.10.0
raw patch · 3 files changed
+37/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Lens.Micro.Mtl: (<.=) :: MonadState s m => LensLike ((,) b) s s a b -> b -> m b
+ Lens.Micro.Mtl: (<?=) :: MonadState s m => LensLike ((,) b) s s a (Maybe b) -> b -> m b
+ Lens.Micro.Mtl: infix 4 <<.=
+ Lens.Micro.Mtl: infixr 2 <~
Files
- CHANGELOG.md +4/−0
- microlens-mtl.cabal +1/−1
- src/Lens/Micro/Mtl.hs +32/−4
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.10.0++* Added `<?=` and `<.=`.+ # 0.1.9.0 * Added `?=` and `<~`.
microlens-mtl.cabal view
@@ -1,5 +1,5 @@ name: microlens-mtl-version: 0.1.9.0+version: 0.1.10.0 synopsis: microlens support for Reader/Writer/State from mtl description: This package contains functions (like 'view' or '+=') which work on 'MonadReader', 'MonadWriter', and 'MonadState' from the mtl package.
src/Lens/Micro/Mtl.hs view
@@ -34,8 +34,8 @@ (+=), (-=), (*=), (//=), -- * Setting with passthrough- (<%=), (<<%=),- (<<.=),+ (<%=), (<.=), (<?=),+ (<<%=), (<<.=), -- * Zooming zoom,@@ -120,7 +120,7 @@ infix 4 .=, %=, ?=-infix 4 <<.=, <<%=, <%=+infix 4 <<.=, <<%=, <%=, <.=, <?= infix 4 +=, -=, *=, //= infixr 2 <~ @@ -266,13 +266,41 @@ @ l '<<.=' b = do old <- 'use' l- l '.=' f+ l '.=' b return old @ -} (<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a l <<.= b = l %%= (\a -> (a, b)) {-# INLINE (<<.=) #-}++{- |+Set state and return new value.++@+l '<.=' b = do+ l '.=' b+ return b+@+-}+(<.=) :: MonadState s m => LensLike ((,) b) s s a b -> b -> m b+l <.= b = l <%= const b+{-# INLINE (<.=) #-}++{- |+('<?=') is a version of ('<.=') that wraps the value into 'Just' before setting.++@+l '<?=' b = do+ l '.=' Just b+ 'return' b+@++It can be useful in combination with 'at'.+-}+(<?=) :: MonadState s m => LensLike ((,) b) s s a (Maybe b) -> b -> m b+l <?= b = l %%= const (b, Just b)+{-# INLINE (<?=) #-} (%%=) :: MonadState s m => LensLike ((,) r) s s a b -> (a -> (r, b)) -> m r #if MIN_VERSION_mtl(2,1,1)