lens 3.8.4 → 3.8.5
raw patch · 20 files changed
+67/−12 lines, 20 filesdep ~generic-deriving
Dependency ranges changed: generic-deriving
Files
- CHANGELOG.markdown +5/−1
- lens.cabal +2/−1
- src/Control/Exception/Lens.hs +1/−0
- src/Control/Lens/At.hs +1/−0
- src/Control/Lens/Each.hs +1/−0
- src/Control/Lens/Getter.hs +1/−0
- src/Control/Lens/Indexed.hs +1/−0
- src/Control/Lens/Iso.hs +1/−0
- src/Control/Lens/Prism.hs +27/−0
- src/Control/Lens/Review.hs +7/−6
- src/Control/Lens/Tuple.hs +1/−0
- src/Control/Lens/Type.hs +1/−0
- src/Control/Lens/Wrapped.hs +1/−1
- src/Data/Bits/Lens.hs +1/−0
- src/Data/HashSet/Lens.hs +2/−1
- src/Data/IntSet/Lens.hs +2/−1
- src/Data/Set/Lens.hs +3/−1
- src/Generics/Deriving/Lens.hs +3/−0
- src/Numeric/Lens.hs +3/−0
- src/System/FilePath/Lens.hs +3/−0
CHANGELOG.markdown view
@@ -1,7 +1,11 @@+3.8.5+-----+* Fixed more sporadic issues in doctests, caused by carrying flags from `$setup` between modules.+ 3.8.4 ----- * Renamed `strippingPrefix` to `prefixed`, `strippingSuffix` to `suffixed`. Left the old names as deprecated aliases.-* Fixed issues with the test suite caused by `doctests` carrying flags from the $setup block between modules.+* Fixed issues with the test suite caused by `doctests` carrying flags from the `$setup` block between modules. * Benchmarks now use `generic-deriving` rather than `ghc-prim` directly, like the rest of the package. * Added `Generics.Deriving.Lens`, which is now simply re-exported from `GHC.Generics.Lens`.
lens.cabal view
@@ -1,6 +1,6 @@ name: lens category: Data, Lenses-version: 3.8.4+version: 3.8.5 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -368,6 +368,7 @@ deepseq, doctest >= 0.9.1, filepath,+ generic-deriving, mtl, nats, parallel,
src/Control/Exception/Lens.hs view
@@ -115,6 +115,7 @@ {-# ANN module "HLint: ignore Use Control.Exception.catch" #-} -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> :m + Control.Exception Control.Monad Data.List Prelude ------------------------------------------------------------------------------
src/Control/Lens/At.hs view
@@ -78,6 +78,7 @@ import Data.Word -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Debug.SimpleReflect.Expr -- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g)
src/Control/Lens/Each.hs view
@@ -104,6 +104,7 @@ type instance Index LazyB.ByteString = Int64 -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Data.Text.Strict.Lens as Text -- >>> import Data.Char as Char
src/Control/Lens/Getter.hs view
@@ -74,6 +74,7 @@ import Data.Profunctor.Unsafe -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Data.List.Lens -- >>> import Debug.SimpleReflect.Expr
src/Control/Lens/Indexed.hs view
@@ -105,6 +105,7 @@ infixr 9 <.>, <., .> -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- | Compose an 'Indexed' function with a non-indexed function.
src/Control/Lens/Iso.hs view
@@ -73,6 +73,7 @@ {-# ANN module "HLint: ignore Use on" #-} -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Data.Map as Map -- >>> import Data.Foldable
src/Control/Lens/Prism.hs view
@@ -47,10 +47,15 @@ #endif -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Numeric.Natural+-- >>> import Debug.SimpleReflect.Expr+-- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g) -- >>> let isLeft (Left _) = True; isLeft _ = False -- >>> let isRight (Right _) = True; isRight _ = False+-- >>> let f :: Expr -> Expr; f = Debug.SimpleReflect.Vars.f+-- >>> let g :: Expr -> Expr; g = Debug.SimpleReflect.Vars.g ------------------------------------------------------------------------------ -- Prism Internals@@ -89,6 +94,7 @@ -- | Build a 'Control.Lens.Prism.Prism'. -- -- @'Either' t a@ is used instead of @'Maybe' a@ to permit the types of @s@ and @t@ to differ.+-- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b prism bt seta = dimap seta (either pure (fmap bt)) . right' {-# INLINE prism #-}@@ -161,6 +167,9 @@ -- -- It also can be turned around to obtain the embedding into the 'Left' half of an 'Either': --+-- >>> _Left # 5+-- Left 5+-- -- >>> 5^.re _Left -- Left 5 _Left :: Prism (Either a c) (Either b c) a b@@ -183,6 +192,9 @@ -- -- It also can be turned around to obtain the embedding into the 'Right' half of an 'Either': --+-- >>> _Right # 5+-- Right 5+-- -- >>> 5^.re _Right -- Right 5 _Right :: Prism (Either c a) (Either c b) a b@@ -196,8 +208,23 @@ -- -- Unlike 'Data.Traversable.traverse' this is a 'Prism', and so you can use it to inject as well: --+-- >>> _Just # 5+-- Just 5+-- -- >>> 5^.re _Just -- Just 5+--+-- Interestingly,+--+-- @+-- m '^?' '_Just' ≡ m+-- @+--+-- >>> Just x ^? _Just+-- Just x+--+-- >>> Nothing ^? _Just+-- Nothing _Just :: Prism (Maybe a) (Maybe b) a b _Just = prism Just $ maybe (Left Nothing) Right {-# INLINE _Just #-}
src/Control/Lens/Review.hs view
@@ -40,6 +40,7 @@ import Data.Profunctor.Unsafe -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Numeric.Lens -- >>> let isLeft (Left _) = True; isLeft _ = False@@ -138,8 +139,8 @@ -- | An infix alias for 'review'. -- -- @--- 'unto' f '#' x ≡ f x--- l '#' x ≡ x '^.' 're' l+-- 'unto' f # x ≡ f x+-- l # x ≡ x '^.' 're' l -- @ -- -- This is commonly used when using a 'Prism' as a smart constructor.@@ -153,10 +154,10 @@ -- "7b" -- -- @--- ('#') :: 'Iso'' s a -> a -> s--- ('#') :: 'Prism'' s a -> a -> s--- ('#') :: 'Review'' s a -> a -> s--- ('#') :: 'Equality'' s a -> a -> s+-- (#) :: 'Iso'' s a -> a -> s+-- (#) :: 'Prism'' s a -> a -> s+-- (#) :: 'Review'' s a -> a -> s+-- (#) :: 'Equality'' s a -> a -> s -- @ ( # ) :: AReview s t a b -> b -> t ( # ) p = runIdentity #. runReviewed #. p .# Reviewed .# Identity
src/Control/Lens/Tuple.hs view
@@ -40,6 +40,7 @@ import Data.Functor.Identity -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- | Provides access to 1st field of a tuple.
src/Control/Lens/Type.hs view
@@ -60,6 +60,7 @@ import Data.Profunctor -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens -- >>> import Debug.SimpleReflect.Expr -- >>> import Debug.SimpleReflect.Vars as Vars hiding (f,g,h)
src/Control/Lens/Wrapped.hs view
@@ -91,8 +91,8 @@ import Data.Tagged -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Control.Lens--- >>> import Data.Foldable -- | 'Wrapped' provides isomorphisms to wrap and unwrap newtypes or -- data types with one constructor.
src/Data/Bits/Lens.hs view
@@ -25,6 +25,7 @@ import Data.Word -- $setup+-- >>> :set -XNoOverloadedStrings -- >>> import Data.Word infixr 4 .|.~, .&.~, <.|.~, <.&.~
src/Data/HashSet/Lens.hs view
@@ -25,7 +25,8 @@ import Data.Hashable -- $setup--- >>> :m + Data.HashSet Control.Lens+-- >>> :set -XNoOverloadedStrings+-- >>> import Control.Lens -- | This 'Setter' can be used to change the type of a 'HashSet' by mapping -- the elements to new values.
src/Data/IntSet/Lens.hs view
@@ -19,7 +19,8 @@ import Data.IntSet as IntSet -- $setup--- >>> :m + Data.IntSet.Lens Control.Lens+-- >>> :set -XNoOverloadedStrings+-- >>> import Control.Lens -- | IntSet isn't Foldable, but this 'Fold' can be used to access the members of an 'IntSet'. --
src/Data/Set/Lens.hs view
@@ -19,8 +19,10 @@ import Control.Lens.Type import Data.Set as Set + -- $setup--- >>> :m + Data.Set.Lens Control.Lens+-- >>> :set -XNoOverloadedStrings+-- >>> import Control.Lens -- | This 'Setter' can be used to change the type of a 'Set' by mapping -- the elements to new values.
src/Generics/Deriving/Lens.hs view
@@ -40,6 +40,9 @@ import qualified Generics.Deriving as Generic import Generics.Deriving hiding (from, to) +-- $setup+-- >>> :set -XNoOverloadedStrings+ -- | Convert from the data type to its representation (or back) -- -- >>> "hello"^.generic.from generic :: String
src/Numeric/Lens.hs view
@@ -15,6 +15,9 @@ import Data.Maybe (fromMaybe) import Numeric (readInt, showIntAtBase) +-- $setup+-- >>> :set -XNoOverloadedStrings+ -- | This 'Prism' extracts can be used to model the fact that every 'Integral' -- type is a subset of 'Integer'. --
src/System/FilePath/Lens.hs view
@@ -28,6 +28,9 @@ import Control.Lens hiding ((<.>)) +-- $setup+-- >>> :set -XNoOverloadedStrings+ infixr 4 </>~, <</>~, <.>~, <<.>~ infix 4 </>=, <</>=, <.>=, <<.>=