lens-family-core 1.2.1 → 1.2.2
raw patch · 5 files changed
+97/−9 lines, 5 filesdep ~basedep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, containers
API changes (from Hackage documentation)
+ Lens.Family.State.Lazy: (%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
+ Lens.Family.State.Lazy: (&&!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
+ Lens.Family.State.Lazy: (*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Lazy: (+!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Lazy: (-!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Lazy: (//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Lazy: (<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
+ Lens.Family.State.Lazy: (||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
+ Lens.Family.State.Strict: (%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
+ Lens.Family.State.Strict: (&&!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
+ Lens.Family.State.Strict: (*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Strict: (+!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Strict: (-!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Strict: (//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
+ Lens.Family.State.Strict: (<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
+ Lens.Family.State.Strict: (||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
+ Lens.Family.Stock: at' :: (Ord k, Functor f) => k -> LensLike' f (Map k v) (Maybe v)
+ Lens.Family.Stock: intAt' :: Functor f => Int -> LensLike' f (IntMap v) (Maybe v)
- Lens.Family.State.Lazy: infix 4 %%=
+ Lens.Family.State.Lazy: infix 4 %!=
- Lens.Family.State.Lazy: infixr 4 <>=
+ Lens.Family.State.Lazy: infixr 4 <>!=
- Lens.Family.State.Strict: infix 4 %%=
+ Lens.Family.State.Strict: infix 4 %!=
- Lens.Family.State.Strict: infixr 4 <>=
+ Lens.Family.State.Strict: infixr 4 <>!=
Files
- lens-family-core.cabal +4/−4
- src/Lens/Family/Identical.hs +0/−1
- src/Lens/Family/State/Lazy.hs +36/−1
- src/Lens/Family/State/Strict.hs +36/−1
- src/Lens/Family/Stock.hs +21/−2
lens-family-core.cabal view
@@ -1,13 +1,13 @@ name: lens-family-core category: Data, Lenses-version: 1.2.1+version: 1.2.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE author: Russell O'Connor maintainer: Russell O'Connor <roconnor@theorem.ca> stability: experimental-copyright: Copyright (C) 2012,2013,2014 Russell O'Connor+copyright: Copyright (C) 2012,2013,2014,2017 Russell O'Connor synopsis: Haskell 98 Lens Families description: Haskell 98 Lens Families build-type: Simple@@ -34,8 +34,8 @@ library build-depends:- base >= 4 && < 5,- containers >= 0.3 && < 0.6,+ base >= 4.8 && < 5,+ containers >= 0.5.8 && < 0.6, transformers >= 0.2.0 && < 0.6 exposed-modules:
src/Lens/Family/Identical.hs view
@@ -1,6 +1,5 @@ module Lens.Family.Identical where -import Control.Applicative import Control.Applicative.Backwards (Backwards(..)) import Data.Functor.Identity (Identity(..)) import Data.Functor.Compose (Compose(..))
src/Lens/Family/State/Lazy.hs view
@@ -13,6 +13,12 @@ , (//=) , (&&=), (||=) , (<>=)+-- * Strict Assignments+ , (%!=)+ , (+!=), (-!=), (*!=)+ , (//!=)+ , (&&!=), (||!=)+ , (<>!=) -- * Types , Zooming -- * Re-exports@@ -27,7 +33,7 @@ import Data.Tuple (swap) import Control.Monad (liftM) import Control.Monad.Trans.Writer.Lazy (Writer, writer, runWriter)-import Control.Monad.Trans.State.Lazy (StateT(..), state, get, modify)+import Control.Monad.Trans.State.Lazy (StateT(..), state, get, modify, modify') import Lens.Family ( LensLike, LensLike' , FoldLike, Constant , ASetter, ASetter', Identity@@ -149,3 +155,32 @@ -- | Monoidally append a value to all referenced fields of the state. (<>=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m () f <>= b = f %= (`mappend` b)++infix 4 %!=++-- | Strictly modify a field of the state.+(%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()+l %!= f = modify' (l %~ f)++infixr 4 +!=, -!=, *!=++(+!=), (-!=), (*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()+f +!= b = f %!= (+ b)+f -!= b = f %!= subtract b+f *!= b = f %!= (* b)++infixr 4 //!=++(//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()+f //!= b = f %!= (/ b)++infixr 4 &&!=, ||!=++(&&!=), (||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()+f &&!= b = f %!= (&& b)+f ||!= b = f %!= (|| b)++infixr 4 <>!=++(<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()+f <>!= b = f %!= (`mappend` b)
src/Lens/Family/State/Strict.hs view
@@ -13,6 +13,12 @@ , (//=) , (&&=), (||=) , (<>=)+-- * Strict Assignments+ , (%!=)+ , (+!=), (-!=), (*!=)+ , (//!=)+ , (&&!=), (||!=)+ , (<>!=) -- * Types , Zooming -- * Re-exports@@ -27,7 +33,7 @@ import Data.Tuple (swap) import Control.Monad (liftM) import Control.Monad.Trans.Writer.Lazy (Writer, writer, runWriter)-import Control.Monad.Trans.State.Strict (StateT(..), state, get, modify)+import Control.Monad.Trans.State.Strict (StateT(..), state, get, modify, modify') import Lens.Family ( LensLike, LensLike' , FoldLike, Constant , ASetter, ASetter', Identity@@ -149,3 +155,32 @@ -- | Monoidally append a value to all referenced fields of the state. (<>=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m () f <>= b = f %= (`mappend` b)++infix 4 %!=++-- | Strictly modify a field of the state.+(%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()+l %!= f = modify' (l %~ f)++infixr 4 +!=, -!=, *!=++(+!=), (-!=), (*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()+f +!= b = f %!= (+ b)+f -!= b = f %!= subtract b+f *!= b = f %!= (* b)++infixr 4 //!=++(//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()+f //!= b = f %!= (/ b)++infixr 4 &&!=, ||!=++(&&!=), (||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()+f &&!= b = f %!= (&& b)+f ||!= b = f %!= (|| b)++infixr 4 <>!=++(<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()+f <>!= b = f %!= (`mappend` b)
src/Lens/Family/Stock.hs view
@@ -10,6 +10,7 @@ , chosen , ix , at, intAt+ , at', intAt' , contains, intContains -- * Stock Traversals , both@@ -32,6 +33,8 @@ import Lens.Family.Phantom (Phantom, coerce) import qualified Data.Map as Map import qualified Data.IntMap as IntMap+import qualified Data.Map.Strict as Map'+import qualified Data.IntMap.Strict as IntMap' import qualified Data.Set as Set import qualified Data.IntSet as IntSet @@ -98,7 +101,7 @@ -- @ -- -- Lens on a given point of a 'Map.Map'.-at k = lens (Map.lookup k) (\m -> maybe (Map.delete k m) (\v' -> Map.insert k v' m))+at = flip Map.alterF intAt :: Functor f => Int -> LensLike' f (IntMap.IntMap v) (Maybe v) -- ^ @@@ -106,7 +109,23 @@ -- @ -- -- Lens on a given point of a 'IntMap.IntMap'.-intAt k = lens (IntMap.lookup k) (\m -> maybe (IntMap.delete k m) (\v' -> IntMap.insert k v' m))+intAt = flip IntMap.alterF++at' :: (Ord k, Functor f) => k -> LensLike' f (Map.Map k v) (Maybe v)+-- ^ @+-- at :: Ord k => k -> Lens' (Map.Map k v) (Maybe v)+-- @+--+-- Lens providing strict access to a given point of a 'Map.Map'.+at' = flip Map'.alterF++intAt' :: Functor f => Int -> LensLike' f (IntMap.IntMap v) (Maybe v)+-- ^ @+-- intAt :: Int -> Lens (IntMap.IntMap v) (Maybe v)+-- @+--+-- Lens providing strict access to a given point of a 'IntMap.IntMap'.+intAt' = flip IntMap'.alterF contains :: (Ord k, Functor f) => k -> LensLike' f (Set.Set k) Bool -- ^ @