optics 0.4.2 → 0.4.2.1
raw patch · 7 files changed
+44/−27 lines, 7 filesdep ~containersdep ~inspection-testingdep ~optics-core
Dependency ranges changed: containers, inspection-testing, optics-core
Files
- CHANGELOG.md +3/−0
- optics.cabal +3/−7
- src/Optics.hs +1/−1
- tests/Optics/Tests/Core.hs +9/−6
- tests/Optics/Tests/Labels/Generic.hs +9/−3
- tests/Optics/Tests/Labels/TH.hs +4/−2
- tests/Optics/Tests/Utils.hs +15/−8
CHANGELOG.md view
@@ -1,3 +1,6 @@+# optics-0.4.2.1 (2023-06-22)+* Fix compilation of tests with GHC 9.4 and 9.6+ # optics-0.4.2 (2022-05-19) * Allow `transformers-0.6` and `mtl-2.3`
optics.cabal view
@@ -1,13 +1,13 @@ cabal-version: 2.2 name: optics-version: 0.4.2+version: 0.4.2.1 license: BSD-3-Clause license-file: LICENSE build-type: Simple maintainer: optics@well-typed.com author: Adam Gundry, Andres Löh, Andrzej Rybczak, Oleg Grenrus tested-with: GHC ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7- || ==9.0.2 || ==9.2.2, GHCJS ==8.4+ || ==9.0.2 || ==9.2.8 || ==9.4.5 || ==9.6.2, GHCJS ==8.4 synopsis: Optics as an abstract interface category: Data, Optics, Lenses description:@@ -19,10 +19,6 @@ This is the "batteries-included" variant with many dependencies; see the @<https://hackage.haskell.org/package/optics-core optics-core>@ package and other @optics-*@ dependencies if you need a more limited dependency footprint.- .- Note: Hackage does not yet display documentation for reexported-modules,- but you can start from the "Optics" module documentation or see the module- list in @<https://hackage.haskell.org/package/optics-core optics-core>@. extra-doc-files: diagrams/*.png@@ -165,7 +161,7 @@ build-depends: base , containers , indexed-profunctors >= 0.1 && <0.2- , inspection-testing >= 0.4.1.1 && <0.5+ , inspection-testing >= 0.5 && <0.6 , mtl , optics , optics-core
src/Optics.hs view
@@ -368,7 +368,7 @@ -- to @A@ then @S@ is isomorphic to @A@, and similarly for other optic kinds. -- -- * Composition and subtyping interact: a lens and a prism can be composed, by--- first thinking of them as traverals using the subtyping relationship. That+-- first thinking of them as traversals using the subtyping relationship. That -- is, if @S@ has a field @U@, and @U@ has a constructor @A@, then @S@ -- contains zero or one @A@s that we can pick out with a traversal (but in -- general there is neither a lens from @S@ to @A@ nor a prism).
tests/Optics/Tests/Core.hs view
@@ -67,8 +67,9 @@ , testCase "optimized rhs09" $ assertSuccess $(inspectTest $ hasNoProfunctors 'rhs09) , testCase "itraverseOf_ itraversed = itraverseOf_ ifolded" $- -- GHC 8.2, 8.6 to 8.10 and 9.2 give a different structure of let bindings.- ghc82and86to810and92failure $(inspectTest $ 'lhs10 === 'rhs10)+ -- GHC 8.2, 8.6 to 8.10 and 9.2 to 9.4 give a different structure of let+ -- bindings.+ assertSuccess $(inspectTest $ 'lhs10 ==~ 'rhs10) , testCase "optimized lhs10a" $ assertSuccess $(inspectTest $ hasNoProfunctors 'lhs10a) , testCase "optimized rhs10a" $@@ -81,7 +82,7 @@ assertSuccess $(inspectTest $ hasNoProfunctors 'rhs11) , testCase "traverseOf_ traversed = traverseOf_ folded" $ -- GHC 8.6 to 8.10 give a different structure of let bindings.- ghc86to810failure $(inspectTest $ 'lhs12 === 'rhs12)+ assertSuccess $(inspectTest $ 'lhs12 ==~ 'rhs12) , testCase "optimized lhs12a" $ assertSuccess $(inspectTest $ hasNoProfunctors 'lhs12a) , testCase "optimized rhs12a" $@@ -93,14 +94,16 @@ , testCase "optimized rhs13" $ assertSuccess $(inspectTest $ hasNoProfunctors 'rhs13) , testCase "traverseOf_ itraversed = traverseOf_ folded" $- -- GHC 8.6 to 8.10 and GHC 9.2 give a different structure of let bindings.- ghc86to810and92failure $(inspectTest $ 'lhs14 ==- 'rhs14)+ -- GHC 8.6 to 8.10 give a different structure of let bindings+ -- GHC 9.2 to 9.4 have very different structure+ ghc92and94failure $(inspectTest $ 'lhs14 ==~ 'rhs14) , testCase "optimized lhs14a" $ assertSuccess $(inspectTest $ hasNoProfunctors 'lhs14a) , testCase "optimized rhs14a" $ assertSuccess $(inspectTest $ hasNoProfunctors 'rhs14a) , testCase "over (itraversed..) = over (mapped..)" $- assertSuccess $(inspectTest $ 'lhs15 === 'rhs15)+ -- GHC 9.2 and 9.4 do w/w transformation and split lhs into two binds.+ ghc92and94failure $(inspectTest $ 'lhs15 === 'rhs15) , testCase "optimized lhs15" $ assertSuccess $(inspectTest $ hasNoProfunctors 'lhs15) , testCase "optimized rhs15" $
tests/Optics/Tests/Labels/Generic.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-}+{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fplugin=Test.Inspection.Plugin -dsuppress-all #-} module Optics.Tests.Labels.Generic where@@ -69,7 +70,7 @@ label1lhs, label1rhs :: forall a. Human a -> String label1lhs s = view #name s-label1rhs s = name (s :: Human a)+label1rhs Human{name} = name label2lhs, label2rhs :: Human a -> [b] -> Human b label2lhs s b = set #pets b s@@ -77,11 +78,16 @@ label3lhs, label3rhs :: Human a -> String label3lhs s = view (#fish % #name) s-label3rhs s = name (fish s :: Fish)+label3rhs Human{fish} = case fish of+ GoldFish{name} -> name+ Herring{name} -> name label4lhs, label4rhs :: Human a -> String -> Human a label4lhs s b = set (#fish % #name) b s-label4rhs s b = s { fish = (fish s) { name = b } }+label4rhs s b = s { fish = case fish s of+ GoldFish{} -> GoldFish b+ Herring{} -> Herring b+ } label5lhs, label5rhs :: Human Mammal -> Bool -> Human Mammal label5lhs s b = set (#pets % traversed % gafield @"lazy") b s
tests/Optics/Tests/Labels/TH.hs view
@@ -6,8 +6,10 @@ import Data.Ord import Data.Word-import Control.Monad.Reader-import Control.Monad.State+import Data.Function (fix)+import Control.Monad (replicateM)+import Control.Monad.Reader (MonadReader (..), runReaderT, asks)+import Control.Monad.State (MonadState (..), gets, evalStateT, modify') import Test.Tasty import Test.Tasty.HUnit import Test.Inspection
tests/Optics/Tests/Utils.hs view
@@ -118,13 +118,13 @@ ghc82andGE90failure = assertSuccess #endif -ghc82and86to810and92failure :: Result -> IO ()+ghc82and86to810and92to94failure :: Result -> IO () #if __GLASGOW_HASKELL__ == 802 \ || __GLASGOW_HASKELL__ >= 806 && __GLASGOW_HASKELL__ <= 810 \- || __GLASGOW_HASKELL__ == 902-ghc82and86to810and92failure = assertFailure'+ || __GLASGOW_HASKELL__ >= 902 && __GLASGOW_HASKELL__ <= 904+ghc82and86to810and92to94failure = assertFailure' #else-ghc82and86to810and92failure = assertSuccess+ghc82and86to810and92to94failure = assertSuccess #endif ghcGE90failure :: Result -> IO ()@@ -134,10 +134,17 @@ ghcGE90failure = assertSuccess #endif -ghc86to810and92failure :: Result -> IO ()+ghc92and94failure :: Result -> IO ()+#if __GLASGOW_HASKELL__ >= 902 && __GLASGOW_HASKELL__ <= 904+ghc92and94failure = assertFailure'+#else+ghc92and94failure = assertSuccess+#endif++ghc86to810and92to94failure :: Result -> IO () #if __GLASGOW_HASKELL__ >= 806 && __GLASGOW_HASKELL__ <= 810 \- || __GLASGOW_HASKELL__ == 902-ghc86to810and92failure = assertFailure'+ || __GLASGOW_HASKELL__ >= 902 && __GLASGOW_HASKELL__ <= 904+ghc86to810and92to94failure = assertFailure' #else-ghc86to810and92failure = assertSuccess+ghc86to810and92to94failure = assertSuccess #endif