genvalidity-hspec-optics 0.1.1.2 → 1.0.0.0
raw patch · 6 files changed
+277/−265 lines, 6 filesdep ~genvaliditydep ~genvalidity-propertysetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: genvalidity, genvalidity-property
API changes (from Hackage documentation)
- Test.Validity.Optics: lensGettingProducesValidOnValid :: (Show s, GenValid s, Show b, GenValid b) => Lens s s b b -> Property
- Test.Validity.Optics: lensSettingProducesValidOnValid :: (Show s, GenValid s, Show b, GenValid b, Show t, Validity t) => Lens s t a b -> Property
- Test.Validity.Optics: lensSpecOnValid :: forall s b. (Show b, Eq b, GenValid b, Show s, Eq s, GenValid s) => Lens s s b b -> Spec
- Test.Validity.Optics: lensGettingProducesValid :: (Show s, GenUnchecked s, Show b, Validity b) => Lens s s b b -> Property
+ Test.Validity.Optics: lensGettingProducesValid :: (Show s, GenValid s, Show b, Validity b) => Lens s s b b -> Property
- Test.Validity.Optics: lensLaw3 :: (Show b, Eq b, Show s, Eq s) => Lens s s a b -> Gen b -> (b -> [b]) -> Gen s -> (s -> [s]) -> Property
+ Test.Validity.Optics: lensLaw3 :: (Show b, Show s, Eq s) => Lens s s a b -> Gen b -> (b -> [b]) -> Gen s -> (s -> [s]) -> Property
- Test.Validity.Optics: lensSettingProducesValid :: (Show s, GenUnchecked s, Show b, GenUnchecked b, Show t, Validity t) => Lens s t a b -> Property
+ Test.Validity.Optics: lensSettingProducesValid :: (Show s, GenValid s, Show b, GenValid b, Show t, Validity t) => Lens s t a b -> Property
- Test.Validity.Optics: lensSpec :: forall s b. (Show b, Eq b, GenUnchecked b, Validity b, Show s, Eq s, GenUnchecked s, Validity s) => Lens s s b b -> Spec
+ Test.Validity.Optics: lensSpec :: forall s b. (Show b, Eq b, GenValid b, Show s, Eq s, GenValid s) => Lens s s b b -> Spec
Files
- CHANGELOG.md +68/−0
- LICENSE +1/−1
- Setup.hs +0/−3
- genvalidity-hspec-optics.cabal +9/−8
- src/Test/Validity/Optics.hs +142/−187
- test/Test/Validity/OpticsSpec.hs +57/−66
+ CHANGELOG.md view
@@ -0,0 +1,68 @@+# Changelog++## [1.0.0.0] - 2021-11-20++* Compatibility with `genvalidity >= 1.0.0.0`+* Renamed every combinator that ends in `OnValid` (or similar) to not have that suffix anymore.++### Removed++* Every combinator that relates to unchecked or invalid values.++## [0.1.1.2] - 2020-02-10++### Changed++* Removed the doctests+* Improved the cabal file+++## [0.1.1.1] - 2018-11-07++### Changed++* Test suite compatibility with `validity >=0.9`, `genvalidity >=0.7` and `genvalidity-property >=0.3`++## [0.1.1.0] - 2018-10-06++### Added++* `shrinkUncheckedDoesNotShrinkToItself`+* `shrinkUncheckedDoesNotShrinkToItselfWithLimit`+* `shrinkValidDoesNotShrinkToItself`+* `shrinkValidDoesNotShrinkToItselfWithLimit`+* `shrinkInvalidDoesNotShrinkToItself`+* `shrinkInvalidDoesNotShrinkToItselfWithLimit`++### Changed++* Added the concept that shrinkValid should not shrink to itself to `shrinkValidSpec` and `shrinkValiditySpec`.++## [0.1.0.0] - 2018-08-25++### Added++* `lensGettingProducesValidOnValid`+* `lensGettingProducesValid`+* `lensGettingProducesValidOnArbitrary`+* `lensGettingProducesValidOnGen `+* `lensSettingProducesValidOnValid`+* `lensSettingProducesValid`+* `lensSettingProducesValidOnArbitrary`+* `lensSettingProducesValidOnGen`++### Changed++* `lensSpec`, `lensSpecOnArbitrary`, `lensSpecOnGen` and `lensSpecOnValid` now also include `lensGettingProducesValid*` and `lensSettingProducesValid*`++## [0.0.0.0] - 2018-06-28++### Added++* `lensLaw1`+* `lensLaw2`+* `lensLaw3`+* `lensSpec`+* `lensSpecOnArbitrary`+* `lensSpecOnGen`+* `lensSpecOnValid`
LICENSE view
@@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2020 Tom Sydney Kerckhove+Copyright (c) 2016-2021 Tom Sydney Kerckhove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
− Setup.hs
@@ -1,3 +0,0 @@-import Distribution.Simple--main = defaultMain
genvalidity-hspec-optics.cabal view
@@ -1,13 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 004821b84416757ce958d7b001cd1844ab379b0ef9aeeddaca7300f64c5515e6 name: genvalidity-hspec-optics-version: 0.1.1.2+version: 1.0.0.0 synopsis: Standard spec's for lens description: Standard spec's for lens (van Laarhoven encoding) category: Testing@@ -15,10 +13,13 @@ bug-reports: https://github.com/NorfairKing/validity/issues author: Tom Sydney Kerckhove maintainer: syd@cs-syd.eu-copyright: Copyright: (c) 2018-2020 Tom Sydney Kerckhove+copyright: Copyright: (c) 2016-2021 Tom Sydney Kerckhove license: MIT license-file: LICENSE build-type: Simple+extra-source-files:+ LICENSE+ CHANGELOG.md source-repository head type: git@@ -35,7 +36,7 @@ build-depends: QuickCheck , base >=4.9 && <=5- , genvalidity >=0.5+ , genvalidity >=1.0 , genvalidity-hspec , hspec , microlens@@ -52,10 +53,10 @@ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: base- , genvalidity >=0.7+ , genvalidity , genvalidity-hspec , genvalidity-hspec-optics- , genvalidity-property >=0.3+ , genvalidity-property , hspec , microlens , validity >=0.9
src/Test/Validity/Optics.hs view
@@ -5,79 +5,53 @@ -- | Standard test `Spec`s for optics module Test.Validity.Optics- ( lensSpecOnValid- , lensSpec- , lensSpecOnArbitrary- , lensSpecOnGen- , lensLaw1- , lensLaw2- , lensLaw3- , lensGettingProducesValidOnValid- , lensGettingProducesValid- , lensGettingProducesValidOnArbitrary- , lensGettingProducesValidOnGen- , lensSettingProducesValidOnValid- , lensSettingProducesValid- , lensSettingProducesValidOnArbitrary- , lensSettingProducesValidOnGen- ) where+ ( lensSpec,+ lensSpecOnArbitrary,+ lensSpecOnGen,+ lensLaw1,+ lensLaw2,+ lensLaw3,+ lensGettingProducesValid,+ lensGettingProducesValidOnArbitrary,+ lensGettingProducesValidOnGen,+ lensSettingProducesValid,+ lensSettingProducesValidOnArbitrary,+ lensSettingProducesValidOnGen,+ )+where +import Data.GenValidity import Lens.Micro import Lens.Micro.Extras--import Data.GenValidity- import Test.Hspec import Test.QuickCheck- import Test.Validity.Utils -- | Standard test spec for properties lenses for valid values -- -- Example usage: ----- > lensSpecOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)-lensSpecOnValid ::- forall s b. (Show b, Eq b, GenValid b, Show s, Eq s, GenValid s)- => Lens s s b b- -> Spec-lensSpecOnValid l =- lensSpecOnGen- l- (genValid @b)- "valid values"- shrinkValid- (genValid @s)- "valid values"- shrinkValid---- | Standard test spec for properties lenses for unchecked values------ Example usage:--- -- > lensSpec ((_2) :: Lens (Int, Int) (Int, Int) Int Int) lensSpec ::- forall s b.- ( Show b- , Eq b- , GenUnchecked b- , Validity b- , Show s- , Eq s- , GenUnchecked s- , Validity s- )- => Lens s s b b- -> Spec+ forall s b.+ ( Show b,+ Eq b,+ GenValid b,+ Show s,+ Eq s,+ GenValid s+ ) =>+ Lens s s b b ->+ Spec lensSpec l =- lensSpecOnGen- l- (genUnchecked @b)- "unchecked values"- shrinkUnchecked- (genUnchecked @s)- "unchecked values"- shrinkUnchecked+ lensSpecOnGen+ l+ (genValid @b)+ "valid values"+ shrinkValid+ (genValid @s)+ "valid values"+ shrinkValid -- | Standard test spec for properties lenses for arbitrary values --@@ -85,27 +59,27 @@ -- -- > lensSpecOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSpecOnArbitrary ::- forall s b.- ( Show b- , Eq b- , Arbitrary b- , Validity b- , Show s- , Eq s- , Arbitrary s- , Validity s- )- => Lens s s b b- -> Spec+ forall s b.+ ( Show b,+ Eq b,+ Arbitrary b,+ Validity b,+ Show s,+ Eq s,+ Arbitrary s,+ Validity s+ ) =>+ Lens s s b b ->+ Spec lensSpecOnArbitrary l =- lensSpecOnGen- l- (arbitrary @b)- "arbitrary values"- shrink- (arbitrary @s)- "arbitrary values"- shrink+ lensSpecOnGen+ l+ (arbitrary @b)+ "arbitrary values"+ shrink+ (arbitrary @s)+ "arbitrary values"+ shrink -- | Standard test spec for properties lenses for values generated by given generators --@@ -120,38 +94,41 @@ -- > "tuples of negative valid doubles" -- > (const []) lensSpecOnGen ::- (Show b, Eq b, Validity b, Show s, Eq s, Validity s)- => Lens s s b b- -> Gen b- -> String- -> (b -> [b])- -> Gen s- -> String- -> (s -> [s])- -> Spec+ (Show b, Eq b, Validity b, Show s, Eq s, Validity s) =>+ Lens s s b b ->+ Gen b ->+ String ->+ (b -> [b]) ->+ Gen s ->+ String ->+ (s -> [s]) ->+ Spec lensSpecOnGen l genB genBName shrinkB genS genSName shrinkS = do- parallel $ do- it- (unwords- ["satisfies the first lens law for", genBName, "and", genSName]) $- lensLaw1 l genB shrinkB genS shrinkS- it (unwords ["satisfies the second lens law for", genSName]) $- lensLaw2 l genS shrinkS- it- (unwords- ["satisfies the third lens law for", genBName, "and", genSName]) $- lensLaw3 l genB shrinkB genS shrinkS- it (unwords ["gets valid values from", genSName, "values"]) $- lensGettingProducesValidOnGen l genS shrinkS- it- (unwords- [ "produces valid values when it is used to set"- , genBName- , "values on"- , genSName- , "values"- ]) $- lensSettingProducesValidOnGen l genB shrinkB genS shrinkS+ parallel $ do+ it+ ( unwords+ ["satisfies the first lens law for", genBName, "and", genSName]+ )+ $ lensLaw1 l genB shrinkB genS shrinkS+ it (unwords ["satisfies the second lens law for", genSName]) $+ lensLaw2 l genS shrinkS+ it+ ( unwords+ ["satisfies the third lens law for", genBName, "and", genSName]+ )+ $ lensLaw3 l genB shrinkB genS shrinkS+ it (unwords ["gets valid values from", genSName, "values"]) $+ lensGettingProducesValidOnGen l genS shrinkS+ it+ ( unwords+ [ "produces valid values when it is used to set",+ genBName,+ "values on",+ genSName,+ "values"+ ]+ )+ $ lensSettingProducesValidOnGen l genB shrinkB genS shrinkS -- | A property combinator for the first lens law: --@@ -161,16 +138,16 @@ -- -- prop> lensLaw1 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensLaw1 ::- (Show b, Eq b, Show s)- => Lens s s b b- -> Gen b- -> (b -> [b])- -> Gen s- -> (s -> [s])- -> Property+ (Show b, Eq b, Show s) =>+ Lens s s b b ->+ Gen b ->+ (b -> [b]) ->+ Gen s ->+ (s -> [s]) ->+ Property lensLaw1 l genB shrinkB genS shrinkS =- forAllShrink genB shrinkB $ \b ->- forAllShrink genS shrinkS $ \s -> view l (set l b s) `shouldBe` b+ forAllShrink genB shrinkB $ \b ->+ forAllShrink genS shrinkS $ \s -> view l (set l b s) `shouldBe` b -- | A property combinator for the second lens law: --@@ -181,7 +158,7 @@ -- prop> lensLaw2 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid lensLaw2 :: (Show s, Eq s) => Lens s s b b -> Gen s -> (s -> [s]) -> Property lensLaw2 l genS shrinkS =- forAllShrink genS shrinkS $ \s -> set l (view l s) s `shouldBe` s+ forAllShrink genS shrinkS $ \s -> set l (view l s) s `shouldBe` s -- | A property combinator for the third lens law: --@@ -191,38 +168,28 @@ -- -- prop> lensLaw3 ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensLaw3 ::- (Show b, Eq b, Show s, Eq s)- => Lens s s a b- -> Gen b- -> (b -> [b])- -> Gen s- -> (s -> [s])- -> Property+ (Show b, Show s, Eq s) =>+ Lens s s a b ->+ Gen b ->+ (b -> [b]) ->+ Gen s ->+ (s -> [s]) ->+ Property lensLaw3 l genB shrinkB genS shrinkS =- forAllShrink genB shrinkB $ \b ->- forAllShrink genB shrinkB $ \b' ->- forAllShrink genS shrinkS $ \s ->- set l b' (set l b s) `shouldBe` set l b' s+ forAllShrink genB shrinkB $ \b ->+ forAllShrink genB shrinkB $ \b' ->+ forAllShrink genS shrinkS $ \s ->+ set l b' (set l b s) `shouldBe` set l b' s -- | A property combinator to test whether getting values via a lens on valid values produces valid values. -- -- Example Usage: ----- prop> lensGettingProducesValidOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)-lensGettingProducesValidOnValid ::- (Show s, GenValid s, Show b, GenValid b) => Lens s s b b -> Property-lensGettingProducesValidOnValid l =- lensGettingProducesValidOnGen l genValid shrinkValid---- | A property combinator to test whether getting values via a lens on unchecked values produces valid values.------ Example Usage:--- -- prop> lensGettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int) lensGettingProducesValid ::- (Show s, GenUnchecked s, Show b, Validity b) => Lens s s b b -> Property+ (Show s, GenValid s, Show b, Validity b) => Lens s s b b -> Property lensGettingProducesValid l =- lensGettingProducesValidOnGen l genUnchecked shrinkUnchecked+ lensGettingProducesValidOnGen l genValid shrinkValid -- | A property combinator to test whether getting values via a lens on arbitrary values produces valid values. --@@ -230,11 +197,11 @@ -- -- prop> lensGettingProducesValidOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensGettingProducesValidOnArbitrary ::- (Show s, Arbitrary s, Show b, Validity b)- => Lens s s b b- -> Property+ (Show s, Arbitrary s, Show b, Validity b) =>+ Lens s s b b ->+ Property lensGettingProducesValidOnArbitrary l =- lensGettingProducesValidOnGen l arbitrary shrink+ lensGettingProducesValidOnGen l arbitrary shrink -- | A property combinator to test whether getting values generated by given a generator via a lens on values generated by a given generator produces valid values. --@@ -244,42 +211,30 @@ -- -- prop> lensGettingProducesValidOnGen ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid lensGettingProducesValidOnGen ::- (Validity b, Show b, Show s)- => Lens s s b b- -> Gen s- -> (s -> [s])- -> Property+ (Validity b, Show b, Show s) =>+ Lens s s b b ->+ Gen s ->+ (s -> [s]) ->+ Property lensGettingProducesValidOnGen l genS shrinkS =- forAllShrink genS shrinkS $ \s -> shouldBeValid $ view l s+ forAllShrink genS shrinkS $ \s -> shouldBeValid $ view l s -- | A property combinator to test whether setting valid values via a lens on valid values produces valid values. -- -- Example usage: ----- prop> lensSettingProducesValidOnValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)-lensSettingProducesValidOnValid ::- (Show s, GenValid s, Show b, GenValid b, Show t, Validity t)- => Lens s t a b- -> Property-lensSettingProducesValidOnValid l =- lensSettingProducesValidOnGen l genValid shrinkValid genValid shrinkValid---- | A property combinator to test whether setting unchecked values via a lens on unchecked values produces valid values.------ Example usage:--- -- prop> lensSettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int) lensSettingProducesValid ::- (Show s, GenUnchecked s, Show b, GenUnchecked b, Show t, Validity t)- => Lens s t a b- -> Property+ (Show s, GenValid s, Show b, GenValid b, Show t, Validity t) =>+ Lens s t a b ->+ Property lensSettingProducesValid l =- lensSettingProducesValidOnGen- l- genUnchecked- shrinkUnchecked- genUnchecked- shrinkUnchecked+ lensSettingProducesValidOnGen+ l+ genValid+ shrinkValid+ genValid+ shrinkValid -- | A property combinator to test whether setting arbitrary values via a lens on arbitrary values produces valid values. --@@ -287,11 +242,11 @@ -- -- prop> lensSettingProducesValidOnArbitrary ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) lensSettingProducesValidOnArbitrary ::- (Show s, Arbitrary s, Show b, Arbitrary b, Show t, Validity t)- => Lens s t a b- -> Property+ (Show s, Arbitrary s, Show b, Arbitrary b, Show t, Validity t) =>+ Lens s t a b ->+ Property lensSettingProducesValidOnArbitrary l =- lensSettingProducesValidOnGen l arbitrary shrink arbitrary shrink+ lensSettingProducesValidOnGen l arbitrary shrink arbitrary shrink -- | A property combinator to test whether setting values generated by given a generator via a lens on values generated by a given generator produces valid values. --@@ -301,13 +256,13 @@ -- -- prop> lensSettingProducesValidOnGen ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational) genValid shrinkValid genValid shrinkValid lensSettingProducesValidOnGen ::- (Show s, Show b, Show t, Validity t)- => Lens s t a b- -> Gen b- -> (b -> [b])- -> Gen s- -> (s -> [s])- -> Property+ (Show s, Show b, Show t, Validity t) =>+ Lens s t a b ->+ Gen b ->+ (b -> [b]) ->+ Gen s ->+ (s -> [s]) ->+ Property lensSettingProducesValidOnGen l genB shrinkB genS shrinkS =- forAllShrink genS shrinkS $ \s ->- forAllShrink genB shrinkB $ \b -> shouldBeValid $ set l b s+ forAllShrink genS shrinkS $ \s ->+ forAllShrink genB shrinkB $ \b -> shouldBeValid $ set l b s
test/Test/Validity/OpticsSpec.hs view
@@ -1,85 +1,76 @@-{-# LANGUAGE TypeApplications #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} module Test.Validity.OpticsSpec where import GHC.Generics (Generic)-+import Lens.Micro import Test.Hspec- import Test.Validity import Test.Validity.Optics -import Lens.Micro- spec :: Spec spec = do- describe "lensSpecOnValid" $- lensSpecOnValid- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensSpec" $ lensSpec ((_2) :: Lens (Int, Int) (Int, Int) Int Int)- describe "lensSpecOnArbitrary" $- lensSpecOnArbitrary- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensSpecOnGen" $- lensSpecOnGen- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- (abs <$> genValid)- "positive valid doubles"- (filter (0.0 >=) . shrinkValid)- ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))- "tuples of negative valid doubles"- (const [])- describe "lensGettingProducesValidOnValid" $- it "holds for (_2) for doubles" $- lensGettingProducesValidOnValid- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensGettingProducesValid" $- it "holds for (_2) for ints" $- lensGettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int)- describe "lensGettingProducesValidOnArbitrary" $- it "holds for (_2) for doubles" $- lensGettingProducesValidOnArbitrary- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensGettingProducesValidOnGen" $- it "holds for (_2) for special generators" $- lensGettingProducesValidOnGen- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))- (const [])- describe "lensSettingProducesValidOnValid" $- it "holds for (_2) for doubles" $- lensSettingProducesValidOnValid- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensSettingProducesValid" $- it "holds for (_2) for ints" $- lensSettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int)- describe "lensSettingProducesValidOnArbitrary" $- it "holds for (_2) for doubles" $- lensSettingProducesValidOnArbitrary- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- describe "lensSettingProducesValidOnGen" $- it "holds for (_2) for special generators" $- lensSettingProducesValidOnGen- ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)- (abs <$> genValid)- (filter (0.0 >=) . shrinkValid)- ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))- (const [])- describe "myBoolLens" $- lensSpecOnValid myBoolLens- describe "myRationalLens" $- lensSpecOnValid myRationalLens+ describe "lensSpec" $ do+ lensSpec ((_2) :: Lens (Int, Int) (Int, Int) Int Int)+ lensSpec ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensSpecOnArbitrary" $+ lensSpecOnArbitrary+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensSpecOnGen" $+ lensSpecOnGen+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ (abs <$> genValid)+ "positive valid doubles"+ (filter (0.0 >=) . shrinkValid)+ ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))+ "tuples of negative valid doubles"+ (const [])+ describe "lensGettingProducesValid" $ do+ it "holds for (_2) for ints" $+ lensGettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int)+ it "holds for (_2) for doubles" $+ lensGettingProducesValid+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensGettingProducesValidOnArbitrary" $+ it "holds for (_2) for doubles" $+ lensGettingProducesValidOnArbitrary+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensGettingProducesValidOnGen" $+ it "holds for (_2) for special generators" $+ lensGettingProducesValidOnGen+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))+ (const [])+ describe "lensSettingProducesValid" $ do+ it "holds for (_2) for ints" $+ lensSettingProducesValid ((_2) :: Lens (Int, Int) (Int, Int) Int Int)+ it "holds for (_2) for doubles" $+ lensSettingProducesValid ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensSettingProducesValidOnArbitrary" $+ it "holds for (_2) for doubles" $+ lensSettingProducesValidOnArbitrary+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ describe "lensSettingProducesValidOnGen" $+ it "holds for (_2) for special generators" $+ lensSettingProducesValidOnGen+ ((_2) :: Lens (Rational, Rational) (Rational, Rational) Rational Rational)+ (abs <$> genValid)+ (filter (0.0 >=) . shrinkValid)+ ((,) <$> (negate . abs <$> genValid) <*> (negate . abs <$> genValid))+ (const [])+ describe "myBoolLens" $+ lensSpec myBoolLens+ describe "myRationalLens" $+ lensSpec myRationalLens data MyRecord = MyRecord- { myBool :: Bool- , myRational :: Rational- } deriving (Show, Eq, Generic)+ { myBool :: Bool,+ myRational :: Rational+ }+ deriving (Show, Eq, Generic) instance Validity MyRecord--instance GenUnchecked MyRecord instance GenValid MyRecord