lens 2.4 → 2.4.0.2
raw patch · 13 files changed
+77/−37 lines, 13 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Bits.Lens: traverseBits :: Bits b => SimpleIndexedTraversal Int b Bool
+ Data.Bits.Lens: traverseBits :: (Num b, Bits b) => SimpleIndexedTraversal Int b Bool
Files
- CHANGELOG.markdown +10/−0
- lens.cabal +1/−1
- src/Control/Lens/Setter.hs +4/−4
- src/Control/Lens/TH.hs +25/−4
- src/Data/Bits/Lens.hs +2/−1
- src/Data/IntSet/Lens.hs +1/−0
- src/Data/Monoid/Lens.hs +8/−8
- src/Data/Pair/Lens.hs +1/−0
- src/Data/Sequence/Lens.hs +1/−0
- src/Data/Set/Lens.hs +1/−0
- src/GHC/Generics/Lens.hs +1/−0
- src/Language/Haskell/TH/Lens.hs +1/−0
- src/System/FilePath/Lens.hs +21/−19
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+2.4.0.2+-------+* GHC 7.6 compatibility++2.4.0.1+-------+* Haddock cleanup+ 2.4 ----- * Added the indexed `Kleene` store to `Control.Lens.Internal`@@ -8,6 +16,8 @@ * Removed `Focus(..)` from `Control.Lens.Type`. * Factored out `Control.Lens.Isomorphic`. * Moved many private types to `Control.Lens.Internal`+* Added `conFields` to `Language.Haskell.TH.Lens`.+* Added `System.FilePath.Lens`. 2.3 ---
lens.cabal view
@@ -1,6 +1,6 @@ name: lens category: Data, Lenses-version: 2.4+version: 2.4.0.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE
src/Control/Lens/Setter.hs view
@@ -328,10 +328,10 @@ -- | Divide the target(s) of a numerically valued 'Control.Lens.Type.Lens', 'Control.Lens.Iso.Iso', 'Setter' or 'Control.Lens.Traversal.Traversal' -- -- @--- (//~) :: 'Fractional' c => 'Setter' a b c c -> c -> a -> b--- (//~) :: 'Fractional' c => 'Control.Lens.Iso.Iso' a b c c -> c -> a -> b--- (//~) :: 'Fractional' c => 'Control.Lens.Type.Lens' a b c c -> c -> a -> b--- (//~) :: 'Fractional' c => 'Control.Lens.Traversal.Traversal' a b c c -> c -> a -> b+-- (\/\/~) :: 'Fractional' c => 'Setter' a b c c -> c -> a -> b+-- (\/\/~) :: 'Fractional' c => 'Control.Lens.Iso.Iso' a b c c -> c -> a -> b+-- (\/\/~) :: 'Fractional' c => 'Control.Lens.Type.Lens' a b c c -> c -> a -> b+-- (\/\/~) :: 'Fractional' c => 'Control.Lens.Traversal.Traversal' a b c c -> c -> a -> b -- @ (//~) :: Fractional c => Setting a b c c -> c -> a -> b l //~ n = over l (/ n)
src/Control/Lens/TH.hs view
@@ -220,7 +220,12 @@ let decl = SigD isoName $ quantified $ isoCon `apps` if cfg^.simpleLenses then [aty,aty,cty,cty] else [aty,bty,cty,dty] body <- makeBody isoName dataConName makeIsoFrom makeIsoTo- inlining <- pragInlD isoName $ inlineSpecNoPhase True False+ inlining <- pragInlD isoName+#if MIN_VERSION_template_haskell(2,8,0)+ Inline FunLike AllPhases+#else+ $ inlineSpecNoPhase True False+#endif return [decl, body, inlining] accessorDecls <- case mkName <$> (maybeFieldName >>= view lensField cfg . nameBase) of jfn@(Just lensName)@@ -229,7 +234,12 @@ if cfg^.simpleLenses then [cty,cty,aty,aty] else [cty,dty,aty,bty] body <- makeBody lensName dataConName makeIsoTo makeIsoFrom- inlining <- pragInlD lensName $ inlineSpecNoPhase True False+ inlining <- pragInlD lensName+#if MIN_VERSION_template_haskell(2,8,0)+ Inline FunLike AllPhases+#else+ $ inlineSpecNoPhase True False+#endif return [decl, body, inlining] _ -> return [] return $ isoDecls ++ accessorDecls@@ -327,7 +337,13 @@ ++ filter (\_ -> cfg^.createInstance) [ instanceD (return []) (conT clsName `appT` conT tyConName) [ funD methodName [clause [varP a] (normalB (varE a)) []]- , pragInlD methodName $ inlineSpecNoPhase True False ]]+ , pragInlD methodName+#if MIN_VERSION_template_haskell(2,8,0)+ Inline FunLike AllPhases+#else+ $ inlineSpecNoPhase True False+#endif+ ]] bodies <- for (toList fieldMap) $ \ (FieldDesc nm cty bds) -> case mkName <$> view lensField cfg (nameBase nm) of Nothing -> return []@@ -352,7 +368,12 @@ then [aty,aty,cty,cty] else [aty,bty,cty,dty] body <- makeFieldLensBody lensName nm cons $ fmap (mkName . view _2) maybeLensClass- inlining <- pragInlD lensName $ inlineSpecNoPhase True False+ inlining <- pragInlD lensName+#if MIN_VERSION_template_haskell(2,8,0)+ Inline FunLike AllPhases+#else+ $ inlineSpecNoPhase True False+#endif return [decl, body, inlining] return $ classDecls ++ Prelude.concat bodies
src/Data/Bits/Lens.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE LiberalTypeSynonyms #-} {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Bits.Lens@@ -154,7 +155,7 @@ -- -- If you supply this an 'Integer', the result will -- be an infinite 'Traversal' that can be productively consumed.-traverseBits :: Bits b => SimpleIndexedTraversal Int b Bool+traverseBits :: (Num b, Bits b) => SimpleIndexedTraversal Int b Bool traverseBits = index $ \f b -> let g n = (,) n <$> f n (testBit b n) bits = Prelude.takeWhile hasBit [0..]
src/Data/IntSet/Lens.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.IntSet.Lens
src/Data/Monoid/Lens.hs view
@@ -28,10 +28,10 @@ -- ("hello!!!","world!!!") -- -- @--- (<>~) :: 'Monoid' c => 'Setter' a b c c -> c -> a -> b--- (<>~) :: 'Monoid' c => 'Iso' a b c c -> c -> a -> b--- (<>~) :: 'Monoid' c => 'Lens' a b c c -> c -> a -> b--- (<>~) :: 'Monoid' c => 'Traversal' a b c c -> c -> a -> b+-- (\<\>~) :: 'Monoid' c => 'Setter' a b c c -> c -> a -> b+-- (\<\>~) :: 'Monoid' c => 'Iso' a b c c -> c -> a -> b+-- (\<\>~) :: 'Monoid' c => 'Lens' a b c c -> c -> a -> b+-- (\<\>~) :: 'Monoid' c => 'Traversal' a b c c -> c -> a -> b -- @ (<>~) :: Monoid c => Setting a b c c -> c -> a -> b l <>~ n = over l (`mappend` n)@@ -40,10 +40,10 @@ -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by 'mappend'ing a value. -- -- @--- (<>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Setter' a b -> b -> m ()--- (<>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Iso' a b -> b -> m ()--- (<>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Lens' a b -> b -> m ()--- (<>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traversal' a b -> b -> m ()+-- (\<\>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Setter' a b -> b -> m ()+-- (\<\>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Iso' a b -> b -> m ()+-- (\<\>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Lens' a b -> b -> m ()+-- (\<\>=) :: ('MonadState' a m, 'Monoid' b) => 'Simple' 'Traversal' a b -> b -> m () -- @ (<>=) :: (MonadState a m, Monoid b) => SimpleSetting a b -> b -> m () l <>= b = State.modify (l <>~ b)
src/Data/Pair/Lens.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE LiberalTypeSynonyms #-}+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Pair.Lens
src/Data/Sequence/Lens.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Sequence.Lens
src/Data/Set/Lens.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Set.Lens
src/GHC/Generics/Lens.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LiberalTypeSynonyms #-}+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : GHC.Generics.Lens
src/Language/Haskell/TH/Lens.hs view
@@ -3,6 +3,7 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Trustworthy #-} #endif+{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Language.Haskell.TH.Lens
src/System/FilePath/Lens.hs view
@@ -17,15 +17,17 @@ import Control.Applicative ((<$>)) import Control.Monad.State.Class as State-import System.FilePath ((</>), (<.>), splitExtension, takeBaseName, takeDirectory, takeExtension, takeFileName)+import System.FilePath+ ( (</>), (<.>), splitExtension+ , takeBaseName, takeDirectory+ , takeExtension, takeFileName+ ) import Control.Lens hiding ((<.>)) - infixr 4 </>~, <</>~, <.>~, <<.>~ infix 4 </>=, <</>=, <.>=, <<.>= - -- | Modify the path by adding another path. -- -- >>> :m + Control.Lens Data.Pair.Lens@@ -33,10 +35,10 @@ -- ("hello/!!!","world/!!!") -- -- @--- (</>~) :: 'Setter' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- (</>~) :: 'Iso' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- (</>~) :: 'Lens' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b--- (</>~) :: 'Traversal' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b+-- (\</\>~) :: 'Setter' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b+-- (\</\>~) :: 'Iso' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b+-- (\</\>~) :: 'Lens' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b+-- (\</\>~) :: 'Traversal' a b 'FilePath' 'FilePath' -> 'FilePath' -> a -> b -- @ (</>~) :: Setting a b FilePath FilePath -> FilePath -> a -> b l </>~ n = over l (</> n)@@ -46,10 +48,10 @@ -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by adding a path. -- -- @--- (</>=) :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'FilePath' -> m ()--- (</>=) :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'FilePath' -> m ()--- (</>=) :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'FilePath' -> m ()--- (</>=) :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'FilePath' -> m ()+-- (\</\>=) :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'FilePath' -> m ()+-- (\</\>=) :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'FilePath' -> m ()+-- (\</\>=) :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'FilePath' -> m ()+-- (\</\>=) :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'FilePath' -> m () -- @ (</>=) :: MonadState a m => SimpleSetting a FilePath -> FilePath -> m () l </>= b = State.modify (l </>~ b)@@ -80,10 +82,10 @@ -- ("hello.!!!","world.!!!") -- -- @--- (</>~) :: 'Setter' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- (</>~) :: 'Iso' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- (</>~) :: 'Lens' a b 'FilePath' 'FilePath' -> 'String' -> a -> b--- (</>~) :: 'Traversal' a b 'FilePath' 'FilePath' -> 'String' -> a -> b+-- (\<.\>~) :: 'Setter' a b 'FilePath' 'FilePath' -> 'String' -> a -> b+-- (\<.\>~) :: 'Iso' a b 'FilePath' 'FilePath' -> 'String' -> a -> b+-- (\<.\>~) :: 'Lens' a b 'FilePath' 'FilePath' -> 'String' -> a -> b+-- (\<.\>~) :: 'Traversal' a b 'FilePath' 'FilePath' -> 'String' -> a -> b -- @ (<.>~) :: Setting a b FilePath FilePath -> String -> a -> b l <.>~ n = over l (<.> n)@@ -93,10 +95,10 @@ -- | Modify the target(s) of a 'Simple' 'Lens', 'Iso', 'Setter' or 'Traversal' by adding an extension. -- -- @--- (<.>=) :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'String' -> m ()--- (<.>=) :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'String' -> m ()--- (<.>=) :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'String' -> m ()--- (<.>=) :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'String' -> m ()+-- (\<.\>=) :: 'MonadState' a m => 'Simple' 'Setter' a 'FilePath' -> 'String' -> m ()+-- (\<.\>=) :: 'MonadState' a m => 'Simple' 'Iso' a 'FilePath' -> 'String' -> m ()+-- (\<.\>=) :: 'MonadState' a m => 'Simple' 'Lens' a 'FilePath' -> 'String' -> m ()+-- (\<.\>=) :: 'MonadState' a m => 'Simple' 'Traversal' a 'FilePath' -> 'String' -> m () -- @ (<.>=) :: MonadState a m => SimpleSetting a FilePath -> String -> m () l <.>= b = State.modify (l <.>~ b)