packages feed

lens 4.13.1 → 4.13.2

raw patch · 15 files changed

+67/−81 lines, 15 filesdep ~hlint

Dependency ranges changed: hlint

Files

.travis.yml view
@@ -15,25 +15,22 @@   include:     - env: CABALVER=1.18 GHCVER=7.4.2       compiler: ": #GHC 7.4.2"-      addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}     - env: CABALVER=1.18 GHCVER=7.6.3       compiler: ": #GHC 7.6.3"-      addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}     - env: CABALVER=1.18 GHCVER=7.8.4       compiler: ": #GHC 7.8.4"-      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}-    - env: CABALVER=1.22 GHCVER=7.10.1-      compiler: ": #GHC 7.10.1"-      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}-    - env: CABALVER=1.22 GHCVER=7.10.2-      compiler: ": #GHC 7.10.2"-      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}+    - env: CABALVER=1.22 GHCVER=7.10.3+      compiler: ": #GHC 7.10.3"+      addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}     - env: CABALVER=1.24 GHCVER=8.0.1       compiler: ": #GHC 8.0.1"-      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}     - env: CABALVER=1.24 GHCVER=head       compiler: ": #GHC head"-      addons: {apt: {packages: [cabal-install-1.24,ghc-head,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+      addons: {apt: {packages: [cabal-install-1.24,ghc-head,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}    allow_failures:    - env: CABALVER=1.24 GHCVER=head@@ -41,7 +38,7 @@ before_install:  - unset CC  - export HAPPYVER=1.19.5- - export ALEXVER=3.1.4+ - export ALEXVER=3.1.7  - export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH  install:@@ -72,7 +69,7 @@      rm -rf $HOME/.cabsnap;      mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;      cabal install --only-dependencies --enable-tests lens.cabal reflection/;-     if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;+     if [ "$GHCVER" = "7.10.3" ]; then cabal install Cabal-1.22.4.0; fi;    fi  # snapshot package-db on cache miss
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+4.13.2+------+* Restore default signature for `Control.Lens.At.at`+* Improve operations for `Data.Sequence.Seq`+* Fix `declarePrisms` behavior on GHC 8 using GADT record syntax+ 4.13.1 ------ * Modified to enable the `doctests` to build with `stack`.
lens.cabal view
@@ -1,6 +1,6 @@ name:          lens category:      Data, Lenses, Generics-version:       4.13.1+version:       4.13.2 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -423,7 +423,7 @@   else     build-depends:       base,-      hlint >= 1.7+      hlint >= 1.9.27  -- Basic benchmarks for the uniplate-style combinators benchmark plated
src/Control/Lens/At.hs view
@@ -52,6 +52,7 @@ import Control.Lens.Traversal import Control.Lens.Lens import Control.Lens.Setter+import Control.Lens.Type import Control.Lens.Indexed import Data.Array.IArray as Array import Data.Array.Unboxed@@ -198,11 +199,9 @@   -- >>> Seq.fromList [] ^? ix 2   -- Nothing   ix :: Index m -> Traversal' m (IxValue m)-#ifdef DEFAULT_SIGNATURES   default ix :: (Applicative f, At m) => Index m -> LensLike' f m (IxValue m)   ix = ixAt   {-# INLINE ix #-}-#endif  -- | An indexed version of 'ix'. --
src/Control/Lens/Each.hs view
@@ -83,11 +83,9 @@ -- ("HELLO","WORLD") class Each s t a b | s -> a, t -> b, s b -> t, t a -> s where   each :: Traversal s t a b-#ifndef HLINT   default each :: (Traversable g, s ~ g a, t ~ g b) => Traversal s t a b   each = traverse   {-# INLINE each #-}-#endif  -- | @'each' :: 'Traversal' (a,a) (b,b) a b@ instance (a~a', b~b') => Each (a,a') (b,b') a b where
src/Control/Lens/Empty.hs view
@@ -63,11 +63,9 @@   -- >>> isn't _Empty [1,2,3]   -- True   _Empty :: Prism' a ()-#ifndef HLINT   default _Empty :: (Monoid a, Eq a) => Prism' a ()   _Empty = only mempty   {-# INLINE _Empty #-}-#endif  #if __GLASGOW_HASKELL__ >= 710 pattern Empty <- (has _Empty -> True) where
src/Control/Lens/Fold.hs view
@@ -200,6 +200,7 @@ {-# ANN module "HLint: ignore Eta reduce" #-} {-# ANN module "HLint: ignore Use camelCase" #-} {-# ANN module "HLint: ignore Use curry" #-}+{-# ANN module "HLint: ignore Use fmap" #-} #endif  infixl 8 ^.., ^?, ^?!, ^@.., ^@?, ^@?!
src/Control/Lens/Indexed.hs view
@@ -16,6 +16,10 @@ {-# OPTIONS_GHC -fno-warn-redundant-constraints #-} #endif +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ #ifndef MIN_VERSION_containers #define MIN_VERSION_containers(x,y,z) 1 #endif@@ -116,15 +120,20 @@ import Data.Profunctor.Unsafe import Data.Reflection import Data.Sequence hiding ((:<), index)-#if !(MIN_VERSION_containers(0,5,0))-import Data.Traversable (sequenceA)-#endif import Data.Tree import Data.Tuple (swap) import Data.Vector (Vector) import qualified Data.Vector as V import Prelude +#if !(MIN_VERSION_base(4,8,0))+import Data.Traversable (sequenceA)+#endif++#ifdef HLINT+{-# ANN module "HLint: ignore Use fmap" #-}+#endif+ infixr 9 <.>, <., .>  -- $setup@@ -231,11 +240,9 @@ class Functor f => FunctorWithIndex i f | f -> i where   -- | Map with access to the index.   imap :: (i -> a -> b) -> f a -> f b-#ifndef HLINT   default imap :: TraversableWithIndex i f => (i -> a -> b) -> f a -> f b   imap = iover itraversed   {-# INLINE imap #-}-#endif    -- | The 'IndexedSetter' for a 'FunctorWithIndex'.   --@@ -640,11 +647,17 @@   {-# INLINE itraverse #-}  -- | The position in the 'Seq' is available as the index.-instance FunctorWithIndex Int Seq-instance FoldableWithIndex Int Seq+instance FunctorWithIndex Int Seq where+  imap = mapWithIndex+instance FoldableWithIndex Int Seq where+  ifoldMap f = Data.Foldable.fold . mapWithIndex f+  ifoldr = foldrWithIndex+  ifoldl f = foldlWithIndex (flip f)+  {-# INLINE ifoldl #-} instance TraversableWithIndex Int Seq where-  itraversed = traversed-  {-# INLINE itraversed #-}+-- The next version of containers will probably offer traverseWithIndex;+-- when that comes out, it should be used for this.+  itraverse f = sequenceA . mapWithIndex f  instance FunctorWithIndex Int Vector where   imap = V.imap
src/Control/Lens/Internal/Instances.hs view
@@ -20,21 +20,3 @@  import Data.Orphans () import Data.Traversable.Instances ()--#if !(MIN_VERSION_semigroupoids(4,2,0))--import Control.Applicative-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable------------------------------------------------------------------------------------ Orphan Instances----------------------------------------------------------------------------------instance Foldable1 ((,) b) where-  foldMap1 f (_, a) = f a--instance Traversable1 ((,) b) where-  traverse1 f (b, a) = (,) b <$> f a--#endif
src/Control/Lens/Internal/PrismTH.hs view
@@ -133,7 +133,7 @@   convertTVBs = map (VarT . bndrName)    next ty args cons =-    makeConsPrisms (conAppsT ty args) (map normalizeCon cons) cls+    makeConsPrisms (conAppsT ty args) (concatMap normalizeCon cons) cls     where     cls | normal    = Nothing         | otherwise = Just ty@@ -473,20 +473,22 @@ nconTypes f x = fmap (\y -> x {_nconTypes = y}) (f (_nconTypes x))  --- | Normalize 'Con' to its constructor name and field types. For 'GadtC' and--- 'RecGadtC', it takes the leftmost name.-normalizeCon :: Con -> NCon-normalizeCon (RecC    conName xs) = NCon conName Nothing (map (view _3) xs)-normalizeCon (NormalC conName xs) = NCon conName Nothing (map (view _2) xs)-normalizeCon (InfixC (_,x) conName (_,y)) = NCon conName Nothing [x,y]+-- | Normalize a single 'Con' to its constructor name and field types.+-- Because GADT syntax allows multiple constructors to be defined at+-- the same time, this function can return multiple normalized results.+normalizeCon :: Con -> [NCon]+normalizeCon (RecC    conName xs) = [NCon conName Nothing (map (view _3) xs)]+normalizeCon (NormalC conName xs) = [NCon conName Nothing (map (view _2) xs)]+normalizeCon (InfixC (_,x) conName (_,y)) = [NCon conName Nothing [x,y]] normalizeCon (ForallC [] [] con) = normalizeCon con -- happens in GADTs-normalizeCon (ForallC _ cx con) = NCon n (cx1 <> cx2) tys-  where-  cx1 = Just cx-  NCon n cx2 tys = normalizeCon con+normalizeCon (ForallC _ cx1 con) =+  [NCon n (Just cx1 <> cx2) tys+     | NCon n cx2 tys <- normalizeCon con ] #if MIN_VERSION_template_haskell(2,11,0)-normalizeCon (GadtC conNames xs _)    = NCon (head conNames) Nothing (map (view _2) xs)-normalizeCon (RecGadtC conNames xs _) = NCon (head conNames) Nothing (map (view _3) xs)+normalizeCon (GadtC conNames xs _)    =+  [ NCon conName Nothing (map (view _2) xs) | conName <- conNames ]+normalizeCon (RecGadtC conNames xs _) =+  [ NCon conName Nothing (map (view _3) xs) | conName <- conNames ] #endif  -- | Compute a prism's name by prefixing an underscore for normal
src/Control/Lens/Plated.hs view
@@ -218,10 +218,8 @@   -- 'plate' will default to 'uniplate' and you can choose to not override   -- it with your own definition.   plate :: Traversal' a a-#ifndef HLINT   default plate :: Data a => Traversal' a a   plate = uniplate-#endif  instance Plated [a] where   plate f (x:xs) = (x:) <$> f xs
src/Control/Lens/Setter.hs view
@@ -100,6 +100,7 @@  #ifdef HLINT {-# ANN module "HLint: ignore Avoid lambda" #-}+{-# ANN module "HLint: ignore Use fmap" #-} #endif  -- $setup
src/Control/Lens/Tuple.hs view
@@ -87,12 +87,10 @@   -- '_1' :: 'Lens' (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'   -- @   _1 :: Lens s t a b-#ifndef HLINT   default _1 :: (Generic s, Generic t, GIxed N0 (Rep s) (Rep t) a b)              => Lens s t a b   _1 = ix proxyN0   {-# INLINE _1 #-}-#endif  instance Field1 (Identity a) (Identity b) a b where   _1 f (Identity a) = Identity <$> f a@@ -158,12 +156,10 @@   -- 'Control.Lens.Fold.foldMapOf' ('Data.Traversable.traverse' '.' '_2') :: ('Data.Traversable.Traversable' t, 'Data.Monoid.Monoid' m) => (s -> m) -> t (b, s) -> m   -- @   _2 :: Lens s t a b-#ifndef HLINT   default _2 :: (Generic s, Generic t, GIxed N1 (Rep s) (Rep t) a b)              => Lens s t a b   _2 = ix proxyN1   {-# INLINE _2 #-}-#endif  instance Field2 (Product f g a) (Product f g' a) (g a) (g' a) where   _2 f (Pair a b) = Pair a <$> f b@@ -210,12 +206,10 @@ class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 3rd field of a tuple.   _3 :: Lens s t a b-#ifndef HLINT   default _3 :: (Generic s, Generic t, GIxed N2 (Rep s) (Rep t) a b)              => Lens s t a b   _3 = ix proxyN2   {-# INLINE _3 #-}-#endif  instance Field3 (a,b,c) (a,b,c') c c' where   _3 k ~(a,b,c) = k c <&> \c' -> (a,b,c')@@ -249,12 +243,10 @@ class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 4th field of a tuple.   _4 :: Lens s t a b-#ifndef HLINT   default _4 :: (Generic s, Generic t, GIxed N3 (Rep s) (Rep t) a b)              => Lens s t a b   _4 = ix proxyN3   {-# INLINE _4 #-}-#endif  instance Field4 (a,b,c,d) (a,b,c,d') d d' where   _4 k ~(a,b,c,d) = k d <&> \d' -> (a,b,c,d')@@ -284,12 +276,10 @@ class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 5th field of a tuple.   _5 :: Lens s t a b-#ifndef HLINT   default _5 :: (Generic s, Generic t, GIxed N4 (Rep s) (Rep t) a b)              => Lens s t a b   _5 = ix proxyN4   {-# INLINE _5 #-}-#endif  instance Field5 (a,b,c,d,e) (a,b,c,d,e') e e' where   _5 k ~(a,b,c,d,e) = k e <&> \e' -> (a,b,c,d,e')@@ -315,12 +305,10 @@ class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 6th field of a tuple.   _6 :: Lens s t a b-#ifndef HLINT   default _6 :: (Generic s, Generic t, GIxed N5 (Rep s) (Rep t) a b)              => Lens s t a b   _6 = ix proxyN5   {-# INLINE _6 #-}-#endif  instance Field6 (a,b,c,d,e,f) (a,b,c,d,e,f') f f' where   _6 k ~(a,b,c,d,e,f) = k f <&> \f' -> (a,b,c,d,e,f')@@ -342,12 +330,10 @@ class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 7th field of a tuple.   _7 :: Lens s t a b-#ifndef HLINT   default _7 :: (Generic s, Generic t, GIxed N6 (Rep s) (Rep t) a b)              => Lens s t a b   _7 = ix proxyN6   {-# INLINE _7 #-}-#endif  instance Field7 (a,b,c,d,e,f,g) (a,b,c,d,e,f,g') g g' where   _7 k ~(a,b,c,d,e,f,g) = k g <&> \g' -> (a,b,c,d,e,f,g')@@ -365,12 +351,10 @@ class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 8th field of a tuple.   _8 :: Lens s t a b-#ifndef HLINT   default _8 :: (Generic s, Generic t, GIxed N7 (Rep s) (Rep t) a b)              => Lens s t a b   _8 = ix proxyN7   {-# INLINE _8 #-}-#endif  instance Field8 (a,b,c,d,e,f,g,h) (a,b,c,d,e,f,g,h') h h' where   _8 k ~(a,b,c,d,e,f,g,h) = k h <&> \h' -> (a,b,c,d,e,f,g,h')@@ -384,12 +368,10 @@ class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s where   -- | Access the 9th field of a tuple.   _9 :: Lens s t a b-#ifndef HLINT   default _9 :: (Generic s, Generic t, GIxed N8 (Rep s) (Rep t) a b)              => Lens s t a b   _9 = ix proxyN8   {-# INLINE _9 #-}-#endif  instance Field9 (a,b,c,d,e,f,g,h,i) (a,b,c,d,e,f,g,h,i') i i' where   _9 k ~(a,b,c,d,e,f,g,h,i) = k i <&> \i' -> (a,b,c,d,e,f,g,h,i')
src/Control/Lens/Zoom.hs view
@@ -54,6 +54,10 @@ import Data.Profunctor.Unsafe import Prelude +#ifdef HLINT+{-# ANN module "HLint: ignore Use fmap" #-}+#endif+ -- $setup -- >>> import Control.Lens -- >>> import Control.Monad.State
src/Control/Monad/Error/Lens.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-}@@ -36,6 +37,10 @@ import qualified Data.Monoid as M import Data.Semigroup (Semigroup(..)) import Prelude++#ifdef HLINT+{-# ANN module "HLint: ignore Use fmap" #-}+#endif  ------------------------------------------------------------------------------ -- Catching