packages feed

microlens-mtl 0.1.10.0 → 0.1.11.0

raw patch · 4 files changed

+69/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Lens.Micro.Mtl: (&~) :: s -> State s a -> s
+ Lens.Micro.Mtl: infixl 1 &~
+ Lens.Micro.Mtl.Internal: Effect :: m r -> Effect m r a
+ Lens.Micro.Mtl.Internal: EffectRWS :: (st -> m (s, st, w)) -> EffectRWS w st m s a
+ Lens.Micro.Mtl.Internal: Err :: Either e a -> Err e a
+ Lens.Micro.Mtl.Internal: Focusing :: m (s, a) -> Focusing m s a
+ Lens.Micro.Mtl.Internal: FocusingErr :: k (Err e s) a -> FocusingErr e k s a
+ Lens.Micro.Mtl.Internal: FocusingMay :: k (May s) a -> FocusingMay k s a
+ Lens.Micro.Mtl.Internal: FocusingOn :: k (f s) a -> FocusingOn f k s a
+ Lens.Micro.Mtl.Internal: FocusingPlus :: k (s, w) a -> FocusingPlus w k s a
+ Lens.Micro.Mtl.Internal: FocusingWith :: m (s, a, w) -> FocusingWith w m s a
+ Lens.Micro.Mtl.Internal: May :: Maybe a -> May a
+ Lens.Micro.Mtl.Internal: [getEffectRWS] :: EffectRWS w st m s a -> st -> m (s, st, w)
+ Lens.Micro.Mtl.Internal: [getEffect] :: Effect m r a -> m r
+ Lens.Micro.Mtl.Internal: [getErr] :: Err e a -> Either e a
+ Lens.Micro.Mtl.Internal: [getMay] :: May a -> Maybe a
+ Lens.Micro.Mtl.Internal: [unfocusingErr] :: FocusingErr e k s a -> k (Err e s) a
+ Lens.Micro.Mtl.Internal: [unfocusingMay] :: FocusingMay k s a -> k (May s) a
+ Lens.Micro.Mtl.Internal: [unfocusingOn] :: FocusingOn f k s a -> k (f s) a
+ Lens.Micro.Mtl.Internal: [unfocusingPlus] :: FocusingPlus w k s a -> k (s, w) a
+ Lens.Micro.Mtl.Internal: [unfocusingWith] :: FocusingWith w m s a -> m (s, a, w)
+ Lens.Micro.Mtl.Internal: [unfocusing] :: Focusing m s a -> m (s, a)
+ Lens.Micro.Mtl.Internal: newtype Effect m r a
+ Lens.Micro.Mtl.Internal: newtype EffectRWS w st m s a
+ Lens.Micro.Mtl.Internal: newtype Err e a
+ Lens.Micro.Mtl.Internal: newtype Focusing m s a
+ Lens.Micro.Mtl.Internal: newtype FocusingErr e k s a
+ Lens.Micro.Mtl.Internal: newtype FocusingMay k s a
+ Lens.Micro.Mtl.Internal: newtype FocusingOn f k s a
+ Lens.Micro.Mtl.Internal: newtype FocusingPlus w k s a
+ Lens.Micro.Mtl.Internal: newtype FocusingWith w m s a
+ Lens.Micro.Mtl.Internal: newtype May a

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.1.11.0++* Exported `Focusing`, etc. from `Lens.Micro.Mtl.Internal`.+* Added `&~`.+ # 0.1.10.0  * Added `<?=` and `<.=`.
microlens-mtl.cabal view
@@ -1,5 +1,5 @@ name:                microlens-mtl-version:             0.1.10.0+version:             0.1.11.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
@@ -29,6 +29,9 @@   (?=),   (<~), +  -- * Convenience+  (&~),+   -- * Specialised modifying operators   -- $arith-note   (+=), (-=), (*=), (//=),@@ -123,6 +126,25 @@ infix  4 <<.=, <<%=, <%=, <.=, <?= infix  4 +=, -=, *=, //= infixr 2 <~+infixl 1 &~++{- |+This can be used to chain lens operations using @op=@ syntax+rather than @op~@ syntax for simple non-type-changing cases.+>>> (10,20) & _1 .~ 30 & _2 .~ 40+(30,40)++>>> (10,20) &~ do _1 .= 30; _2 .= 40+(30,40)++This does not support type-changing assignment, /e.g./++>>> (10,20) & _1 .~ "hello"+("hello",20)+-}+(&~) :: s -> State s a -> s+s &~ l = execState l s+{-# INLINE (&~) #-}  {- | Modify state by “assigning” a value to a part of the state.
src/Lens/Micro/Mtl/Internal.hs view
@@ -27,10 +27,27 @@ -} module Lens.Micro.Mtl.Internal (+  -- * Classes   Zoomed,   Zoom(..),   Magnified,   Magnify(..),++  -- * Focusing (used for 'Zoom')+  Focusing(..),+  FocusingWith(..),+  FocusingPlus(..),+  FocusingOn(..),+  FocusingMay(..),+  FocusingErr(..),++  -- * Effect (used for 'Magnify')+  Effect(..),+  EffectRWS(..),++  -- * Utilities+  May(..),+  Err(..), ) where @@ -309,6 +326,17 @@     return [(x', y')]   ... @++Finally, you might need to write your own instances of 'Zoom' if you use @newtype@d transformers in your monad stack. This can be done as follows:++@+import "Lens.Micro.Mtl.Internal"++type instance 'Zoomed' (MyStateT s m) = 'Zoomed' (StateT s m)++instance Monad m =\> 'Zoom' (MyStateT s m) (MyStateT t m) s t where+    'zoom' l (MyStateT m) = MyStateT ('zoom' l m)+@   -}   zoom :: LensLike' (Zoomed m c) t s -> m c -> n c @@ -423,6 +451,19 @@   protocol \<- 'Data.Maybe.fromMaybe' \"https\" '<$>' 'Lens.Micro.Mtl.view' protocol   path     \<- 'Lens.Micro.Mtl.view' path   return (protocol ++ path)+@++This concludes the example.++Finally, you should know writing instances of 'Magnify' for your own types can be done as follows:++@+import "Lens.Micro.Mtl.Internal"++type instance 'Magnified' (MyReaderT r m) = 'Magnified' (ReaderT r m)++instance Monad m =\> 'Magnify' (MyReaderT r m) (MyReaderT t m) r t where+    'magnify' l (MyReaderT m) = MyReaderT ('magnify' l m) @   -}   magnify :: LensLike' (Magnified m c) a b -> m c -> n c