packages feed

lens 4.19.1 → 4.19.2

raw patch · 13 files changed

+156/−78 lines, 13 filesdep −test-framework-thdep ~call-stackdep ~doctestdep ~th-abstractionPVP ok

version bump matches the API change (PVP)

Dependencies removed: test-framework-th

Dependency ranges changed: call-stack, doctest, th-abstraction

API changes (from Hackage documentation)

Files

.travis.yml view
@@ -2,9 +2,13 @@ # #   haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project' #+# To regenerate the script (for example after adjusting tested-with) run+#+#   haskell-ci regenerate+# # For more information, see https://github.com/haskell-CI/haskell-ci #-# version: 0.9.20200125+# version: 0.10 # version: ~> 1.0 language: c@@ -19,7 +23,7 @@       - irc.freenode.org#haskell-lens     skip_join: true     template:-      - "\"\\x0313lens\\x03/\\x0306%{branch}\\x03 \\x0314%{commit}\\x03 %{build_url} %{message}\""+      - "\x0313lens\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" cache:   directories:     - $HOME/.cabal/packages@@ -39,39 +43,33 @@     - compiler: ghc-8.10.1       addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2","freeglut3-dev"]}}       os: linux-    - compiler: ghc-8.8.2-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.2","cabal-install-3.0","freeglut3-dev"]}}+    - compiler: ghc-8.8.3+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-8.6.5-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-8.4.4-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-8.2.2-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-8.0.2-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-7.10.3-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-7.8.4-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-7.6.3-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.6.3","cabal-install-3.0","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.6.3","cabal-install-3.2","freeglut3-dev"]}}       os: linux     - compiler: ghc-7.4.2-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.4.2","cabal-install-3.0","freeglut3-dev"]}}-      os: linux-    - compiler: ghc-head-      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-head","cabal-install-head","freeglut3-dev"]}}+      addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.4.2","cabal-install-3.2","freeglut3-dev"]}}       os: linux-  allow_failures:-    - compiler: ghc-head-    - compiler: ghc-8.10.1 before_install:   - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')   - WITHCOMPILER="-w $HC"@@ -89,7 +87,6 @@   - TEST=--enable-tests   - BENCH=--enable-benchmarks   - HEADHACKAGE=false-  - if [ $HCNUMVER -ge 81000 ] ; then HEADHACKAGE=true ; fi   - rm -f $CABALHOME/config   - |     echo "verbose: normal +nowrap +markoutput"          >> $CABALHOME/config@@ -107,17 +104,6 @@     echo "  prefix: $CABALHOME"                         >> $CABALHOME/config     echo "repository hackage.haskell.org"               >> $CABALHOME/config     echo "  url: http://hackage.haskell.org/"           >> $CABALHOME/config-  - |-    if $HEADHACKAGE; then-    echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config-    echo "repository head.hackage.ghc.haskell.org"                                        >> $CABALHOME/config-    echo "   url: https://ghc.gitlab.haskell.org/head.hackage/"                           >> $CABALHOME/config-    echo "   secure: True"                                                                >> $CABALHOME/config-    echo "   root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config-    echo "              26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config-    echo "              f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config-    echo "   key-threshold: 3"                                                            >> $CABALHOME/config-    fi install:   - ${CABAL} --version   - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"@@ -127,10 +113,10 @@   - cat $CABALHOME/config   - rm -fv cabal.project cabal.project.local cabal.project.freeze   - travis_retry ${CABAL} v2-update -v-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $WITHCOMPILER --dry-run hlint  --constraint='hlint ==2.2.*' |  perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi-  - "if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then if [ ! -e $HOME/.hlint/hlint-$HLINTVER/hlint ]; then echo \"Downloading HLint version $HLINTVER\"; mkdir -p $HOME/.hlint; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\\n' --silent --location --output $HOME/.hlint/hlint-$HLINTVER.tar.gz \"https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz\"; tar -xzv -f $HOME/.hlint/hlint-$HLINTVER.tar.gz -C $HOME/.hlint; fi ; fi"-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then mkdir -p $CABALHOME/bin && ln -sf "$HOME/.hlint/hlint-$HLINTVER/hlint" $CABALHOME/bin/hlint ; fi-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then hlint --version ; fi+  - if [ $HCNUMVER -ge 81000 ] ; then HLINTVER=$(cd /tmp && (${CABAL} v2-install -v $WITHCOMPILER --dry-run hlint  --constraint='hlint ==2.2.*' |  perl -ne 'if (/\bhlint-(\d+(\.\d+)*)\b/) { print "$1"; last; }')); echo "HLint version $HLINTVER" ; fi+  - "if [ $HCNUMVER -ge 81000 ] ; then if [ ! -e $HOME/.hlint/hlint-$HLINTVER/hlint ]; then echo \"Downloading HLint version $HLINTVER\"; mkdir -p $HOME/.hlint; curl --write-out 'Status Code: %{http_code} Redirects: %{num_redirects} Total time: %{time_total} Total Dsize: %{size_download}\\n' --silent --location --output $HOME/.hlint/hlint-$HLINTVER.tar.gz \"https://github.com/ndmitchell/hlint/releases/download/v$HLINTVER/hlint-$HLINTVER-x86_64-linux.tar.gz\"; tar -xzv -f $HOME/.hlint/hlint-$HLINTVER.tar.gz -C $HOME/.hlint; fi ; fi"+  - if [ $HCNUMVER -ge 81000 ] ; then mkdir -p $CABALHOME/bin && ln -sf "$HOME/.hlint/hlint-$HLINTVER/hlint" $CABALHOME/bin/hlint ; fi+  - if [ $HCNUMVER -ge 81000 ] ; then hlint --version ; fi   # Generate cabal.project   - rm -rf cabal.project cabal.project.local cabal.project.freeze   - touch cabal.project@@ -138,6 +124,12 @@     echo "packages: ." >> cabal.project     echo "packages: ./examples" >> cabal.project     echo "packages: ./lens-properties" >> cabal.project+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens-examples' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens-properties' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"   - |   - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(lens|lens-examples|lens-properties)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"   - cat cabal.project || true@@ -148,7 +140,7 @@   - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}   - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"   - rm  cabal.project.freeze-  - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all+  - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all script:   - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)   # Packaging...@@ -168,6 +160,12 @@     echo "packages: ${PKGDIR_lens}" >> cabal.project     echo "packages: ${PKGDIR_lens_examples}" >> cabal.project     echo "packages: ${PKGDIR_lens_properties}" >> cabal.project+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens-examples' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"+  - if [ $HCNUMVER -ge 80200 ] ; then echo 'package lens-properties' >> cabal.project ; fi+  - "if [ $HCNUMVER -ge 80200 ] ; then echo '  ghc-options: -Werror=missing-methods' >> cabal.project ; fi"   - |   - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(lens|lens-examples|lens-properties)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"   - cat cabal.project || true@@ -178,9 +176,9 @@   # Testing...   - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all   # HLint..-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then (cd ${PKGDIR_lens} && hlint src) ; fi-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then (cd ${PKGDIR_lens_examples} && hlint .) ; fi-  - if [ $HCNUMVER -ge 80800 ] && [ $HCNUMVER -lt 81000 ] ; then (cd ${PKGDIR_lens_properties} && hlint src) ; fi+  - if [ $HCNUMVER -ge 81000 ] ; then (cd ${PKGDIR_lens} && hlint src) ; fi+  - if [ $HCNUMVER -ge 81000 ] ; then (cd ${PKGDIR_lens_examples} && hlint .) ; fi+  - if [ $HCNUMVER -ge 81000 ] ; then (cd ${PKGDIR_lens_properties} && hlint src) ; fi   # cabal check...   - (cd ${PKGDIR_lens} && ${CABAL} -vnormal check)   - (cd ${PKGDIR_lens_examples} && ${CABAL} -vnormal check)@@ -188,5 +186,5 @@   # haddock...   - if [ $HCNUMVER -lt 70600 ] || [ $HCNUMVER -ge 70800 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi -# REGENDATA ("0.9.20200125",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])+# REGENDATA ("0.10",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"]) # EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+4.19.2 [2020.04.15]+-------------------+* Remove the test suite's dependency on `test-framework-th`.+ 4.19.1 [2020.02.13] ------------------- * Fix a bug introduced in 4.19 where using `_TupE` to `preview` a value would
benchmarks/alongside.hs view
@@ -2,6 +2,8 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}+module Main (main) where+ import Control.Applicative import Control.Comonad import Control.Comonad.Store.Class@@ -9,7 +11,6 @@ import Control.Lens import Criterion.Main import Data.Functor.Compose-import Data.Functor.Identity  -- | A finally encoded Store newtype Experiment a b s = Experiment { runExperiment :: forall f. Functor f => (a -> f b) -> f s }@@ -90,11 +91,12 @@          (\(s, (s', (s'', (s''', s'''')))) (t, (t', (t'', (t''', t''''))))            -> (set l t s, (set l' t' s', (set l'' t'' s'', (set l''' t''' s''', set l'''' t'''' s'''')))) ) +main :: IO () main = defaultMain-    [ bench "alongside1" $ nf (view $ alongside _1 _2) (("hi", 1), (2, "there!"))-    , bench "trial1" $ nf (view $ trial _1 _2) (("hi", 1), (2, "there!"))-    , bench "half1" $ nf (view $ half _1 _2) (("hi", 1), (2, "there!"))-    , bench "compound1"  $ nf (view $ compound _1 _2) (("hi", 1), (2, "there!"))+    [ bench "alongside1" $ nf (view $ alongside _1 _2) (("hi", v), (w, "there!"))+    , bench "trial1" $ nf (view $ trial _1 _2) (("hi", v), (w, "there!"))+    , bench "half1" $ nf (view $ half _1 _2) (("hi", v), (w, "there!"))+    , bench "compound1"  $ nf (view $ compound _1 _2) (("hi", v), (w, "there!"))     , bench "alongside5"  $ nf (view $ (alongside _1 (alongside _1 (alongside _1 (alongside _1 _1)))))       ((v,v),((v,v),((v,v),((v,v),(v,v)))))     , bench "trial5"  $ nf (view $ (trial _1 (trial _1 (trial _1 (trial _1 _1)))))@@ -105,3 +107,4 @@       ((v,v),((v,v),((v,v),((v,v),(v,v)))))     ]   where v = 1 :: Int+        w = 2 :: Int
benchmarks/folds.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE BangPatterns #-}+module Main (main) where  import qualified Data.ByteString as BS import qualified Data.Foldable as F
benchmarks/plated.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE Rank2Types #-} {-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-} {-# OPTIONS_GHC -funbox-strict-fields #-}+module Main (main) where  #ifndef MIN_VERSION_base #define MIN_VERSION_base(x,y,z) 1
benchmarks/traversals.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -fno-warn-orphans #-}+module Main (main) where  import qualified Data.ByteString as BS import qualified Data.HashMap.Strict as HM
benchmarks/unsafe.hs view
@@ -1,16 +1,10 @@ {-# LANGUAGE BangPatterns #-}-module Main where+module Main (main) where  import Control.Lens-import Control.Lens.Internal-import Control.Exception  import Criterion.Main import Criterion.Types (Config(..))--import Data.Functor.Identity (Identity(..))--import GHC.Exts  overS :: ASetter s t a b -> (a -> b) -> s -> t overS l f = runIdentity . l (Identity . f)
examples/lens-examples.cabal view
@@ -24,7 +24,7 @@              , GHC == 8.2.2              , GHC == 8.4.4              , GHC == 8.6.5-             , GHC == 8.8.2+             , GHC == 8.8.3              , GHC == 8.10.1  source-repository head
lens-properties/lens-properties.cabal view
@@ -21,7 +21,7 @@              , GHC == 8.2.2              , GHC == 8.4.4              , GHC == 8.6.5-             , GHC == 8.8.2+             , GHC == 8.8.3              , GHC == 8.10.1  extra-source-files:@@ -36,10 +36,11 @@   build-depends:     base         >= 4.5 && < 5,     lens         >= 4   && < 5,-    QuickCheck   >= 2.4 && < 2.14,+    QuickCheck   >= 2.4 && < 2.15,     transformers >= 0.2 && < 0.6    exposed-modules:     Control.Lens.Properties    hs-source-dirs: src+  ghc-options: -Wall
lens-properties/src/Control/Lens/Properties.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE LiberalTypeSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -12,11 +13,12 @@     , isPrism     ) where +#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative+#endif import Control.Lens import Data.Functor.Compose import Test.QuickCheck-import Test.QuickCheck.Function  -------------------------------------------------------------------------------- -- | A 'Setter' is only legal if the following 3 laws hold:
lens.cabal view
@@ -1,6 +1,6 @@ name:          lens category:      Data, Lenses, Generics-version:       4.19.1+version:       4.19.2 license:       BSD2 cabal-version: 1.18 license-file:  LICENSE@@ -20,7 +20,7 @@              , GHC == 8.2.2              , GHC == 8.4.4              , GHC == 8.6.5-             , GHC == 8.8.2+             , GHC == 8.8.3              , GHC == 8.10.1 synopsis:      Lenses, Folds and Traversals description:@@ -388,7 +388,7 @@   main-is: properties.hs   other-modules:     Control.Lens.Properties-  ghc-options: -w -threaded -rtsopts -with-rtsopts=-N+  ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N   hs-source-dirs:     tests     lens-properties/src@@ -403,13 +403,12 @@       QuickCheck                 >= 2.4,       test-framework             >= 0.6,       test-framework-quickcheck2 >= 0.2,-      test-framework-th          >= 0.2,       transformers  test-suite hunit   type: exitcode-stdio-1.0   main-is: hunit.hs-  ghc-options: -w -threaded -rtsopts -with-rtsopts=-N+  ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N   hs-source-dirs: tests   default-language: Haskell2010 @@ -423,8 +422,7 @@       lens,       mtl,       test-framework       >= 0.6,-      test-framework-hunit >= 0.2,-      test-framework-th    >= 0.2+      test-framework-hunit >= 0.2  -- Verify the results of the examples test-suite doctests@@ -486,7 +484,7 @@ benchmark alongside   type:             exitcode-stdio-1.0   main-is:          alongside.hs-  ghc-options:      -w -O2 -threaded -fdicts-cheap -funbox-strict-fields+  ghc-options:      -Wall -O2 -threaded -fdicts-cheap -funbox-strict-fields   hs-source-dirs:   benchmarks   default-language: Haskell2010   build-depends:@@ -501,7 +499,7 @@ benchmark folds   type:             exitcode-stdio-1.0   main-is:          folds.hs-  ghc-options:      -w -O2 -threaded -fdicts-cheap -funbox-strict-fields+  ghc-options:      -Wall -O2 -threaded -fdicts-cheap -funbox-strict-fields   hs-source-dirs:   benchmarks   default-language: Haskell2010   build-depends:@@ -517,7 +515,7 @@ benchmark traversals   type:             exitcode-stdio-1.0   main-is:          traversals.hs-  ghc-options:      -w -O2 -threaded -fdicts-cheap -funbox-strict-fields+  ghc-options:      -Wall -O2 -threaded -fdicts-cheap -funbox-strict-fields   hs-source-dirs:   benchmarks   default-language: Haskell2010   build-depends:@@ -534,7 +532,7 @@ benchmark unsafe   type:             exitcode-stdio-1.0   main-is:          unsafe.hs-  ghc-options:      -w -O2 -threaded -fdicts-cheap -funbox-strict-fields+  ghc-options:      -Wall -O2 -threaded -fdicts-cheap -funbox-strict-fields   hs-source-dirs:   benchmarks   default-language: Haskell2010   build-depends:
tests/hunit.hs view
@@ -1,5 +1,12 @@ {-# OPTIONS_GHC -fno-warn-missing-signatures #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-}++#if __GLASGOW_HASKELL__ < 706+-- Needed to avoid spurious warnings on GHC 7.4 due to an old TH bug+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+#endif+ ----------------------------------------------------------------------------- -- | -- Module      :  Main (hunit)@@ -16,16 +23,17 @@ -- of what is possible using the lens package; there are a great many use cases -- (and lens functions) that aren't covered. ------------------------------------------------------------------------------module Main where+module Main (main) where  import Control.Lens import Control.Monad.State import Data.Char import Data.List as List-import Data.Monoid import Data.Map as Map+#if !(MIN_VERSION_base(4,11,0))+import Data.Monoid+#endif import Test.Framework.Providers.HUnit-import Test.Framework.TH import Test.Framework import Test.HUnit hiding (test) @@ -276,4 +284,42 @@                          , Point { _x = 8, _y = 0 } ] }  main :: IO ()-main = defaultMain [$testGroupGenerator]+main = defaultMain+  [ testGroup "Main"+    [ testCase "read record field" case_read_record_field+    , testCase "read state record field" case_read_state_record_field+    , testCase "read record field and apply function" case_read_record_field_and_apply_function+    , testCase "read state record field and apply function" case_read_state_record_field_and_apply_function+    , testCase "write record field" case_write_record_field+    , testCase "write state record field" case_write_state_record_field+    , testCase "write record field and access new value" case_write_record_field_and_access_new_value+    , testCase "write state record field and access new value" case_write_state_record_field_and_access_new_value+    , testCase "write record field and access old value" case_write_record_field_and_access_old_value+    , testCase "write state record field and access old value" case_write_state_record_field_and_access_old_value+    , testCase "modify record field" case_modify_record_field+    , testCase "modify state record field" case_modify_state_record_field+    , testCase "modify record field and access new value" case_modify_record_field_and_access_new_value+    , testCase "modify state record field and access new value" case_modify_state_record_field_and_access_new_value+    , testCase "modify record field and access old value" case_modify_record_field_and_access_old_value+    , testCase "modify state record field and access old value" case_modify_state_record_field_and_access_old_value+    , testCase "modify record field and access side result" case_modify_record_field_and_access_side_result+    , testCase "increment record field" case_increment_record_field+    , testCase "increment state record field" case_increment_state_record_field+    , testCase "append to record field" case_append_to_record_field+    , testCase "append to state record field" case_append_to_state_record_field+    , testCase "append to record field and access new value" case_append_to_record_field_and_access_new_value+    , testCase "append to state record field and access new value" case_append_to_state_record_field_and_access_new_value+    , testCase "append to record field and access old value" case_append_to_record_field_and_access_old_value+    , testCase "append to state record field and access old value" case_append_to_state_record_field_and_access_old_value+    , testCase "read maybe map entry" case_read_maybe_map_entry+    , testCase "read maybe state map entry" case_read_maybe_state_map_entry+    , testCase "read map entry" case_read_map_entry+    , testCase "read state map entry" case_read_state_map_entry+    , testCase "modify map entry" case_modify_map_entry+    , testCase "insert maybe map entry" case_insert_maybe_map_entry+    , testCase "delete maybe map entry" case_delete_maybe_map_entry+    , testCase "read list entry" case_read_list_entry+    , testCase "write list entry" case_write_list_entry+    , testCase "write through list entry" case_write_through_list_entry+    ]+  ]
tests/properties.hs view
@@ -1,6 +1,6 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-}-{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ExtendedDefaultRules #-} {-# LANGUAGE LiberalTypeSynonyms #-}@@ -26,18 +26,19 @@ ----------------------------------------------------------------------------- module Main where +#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative+#endif import Control.Lens import Test.QuickCheck-import Test.QuickCheck.Function-import Test.Framework.TH+import Test.Framework import Test.Framework.Providers.QuickCheck2 import Data.Char (isAlphaNum, isAscii, toUpper) import Data.Text.Strict.Lens-import Data.Maybe import Data.List.Lens-import Data.Functor.Compose+#if __GLASGOW_HASKELL__ >= 708 import GHC.Exts (Constraint)+#endif import Numeric (showHex, showOct, showSigned) import Numeric.Lens import Control.Lens.Properties (isIso, isLens, isPrism, isSetter, isTraversal)@@ -106,7 +107,7 @@           ] prop_base_readFail (s :: String) =   forAll (choose (2,36)) $ \b ->-    not isValid ==> s ^? base b == Nothing+    not isValid ==> s ^? base b == (Nothing :: Maybe Integer)   where     isValid = (not . null) sPos && all isValidChar sPos     sPos = case s of { ('-':s') -> s'; _ -> s }@@ -125,7 +126,7 @@ samplePolyEquality :: Equality Monad Identity Monad Identity samplePolyEquality f = f -lessSimplePoly :: forall KVS(k1 k2) (s :: k1) (t :: k2) (a :: k1) (b :: k2) .+lessSimplePoly :: forall KVS(k1 k2) (a :: k1) (b :: k2) .                   Equality a b a b lessSimplePoly f = f @@ -145,4 +146,32 @@   main :: IO ()-main = $defaultMainGenerator+main = defaultMain+  [ testGroup "Main"+    [ testProperty "1" prop_1+    , testProperty "2" prop_2+    , testProperty "3" prop_3+    , testProperty "4" prop_4+    , testProperty "5" prop_5+    , testProperty "6" prop_6+    , testProperty "7" prop_7+    , testProperty "8" prop_8+    , testProperty "9" prop_9+    , testProperty "10" prop_10+    , testProperty "2 2" prop_2_2+    , testProperty "mapped" prop_mapped+    , testProperty "mapped mapped" prop_mapped_mapped+    , testProperty "both" prop_both+    , testProperty "traverseLeft" prop_traverseLeft+    , testProperty "traverseRight" prop_traverseRight+    , testProperty "simple" prop_simple+    , testProperty " Left" prop__Left+    , testProperty " Right" prop__Right+    , testProperty " Just" prop__Just+    , testProperty "prefixed" prop_prefixed+    , testProperty "text" prop_text+    , testProperty "base show" prop_base_show+    , testProperty "base read" prop_base_read+    , testProperty "base readFail" prop_base_readFail+    ]+  ]