git.iko.soy/typeable/generic-arbitrary
on master help sign in
typos
4876174Aleksey Uymanov
README.md+20−17
@@ -93,7 +93,7 @@ there is a problem with mutually recursive types.
93
93
94# Type parameters
94# Type parameters
95
95
96−Now lets see an example of datatype with parameters
96+Now let's see an example of datatype with parameters
97
97
98``` haskell
98``` haskell
99data A a = A a
99data A a = A a
@@ -108,25 +108,28 @@ instance (Arbitrary a) => Arbitrary (A a) where
108
108
109It should work from first glance, but when compile it will throw an error:
109It should work from first glance, but when compile it will throw an error:
110
110
111+```
111−> • Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
112+• Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
112−> (A a)
113+ (A a)
113−> (GHC.Generics.D1
114+ (GHC.Generics.D1
114−> ('GHC.Generics.MetaData "A" "ParametersTest" "main" 'False)
115+ ('GHC.Generics.MetaData "A" "ParametersTest" "main" 'False)
115−> (GHC.Generics.C1
116+ (GHC.Generics.C1
116−> ('GHC.Generics.MetaCons "A" 'GHC.Generics.PrefixI 'False)
117+ ('GHC.Generics.MetaCons "A" 'GHC.Generics.PrefixI 'False)
117−> (GHC.Generics.S1
118+ (GHC.Generics.S1
118−> ('GHC.Generics.MetaSel
119+ ('GHC.Generics.MetaSel
119−> 'Nothing
120+ 'Nothing
120−> 'GHC.Generics.NoSourceUnpackedness
121+ 'GHC.Generics.NoSourceUnpackedness
121−> 'GHC.Generics.NoSourceStrictness
122+ 'GHC.Generics.NoSourceStrictness
122−> 'GHC.Generics.DecidedLazy)
123+ 'GHC.Generics.DecidedLazy)
123−> (GHC.Generics.Rec0 a))))
124+ (GHC.Generics.Rec0 a))))
124−> (TypesDiffer (A a) a))
125+ (TypesDiffer (A a) a))
125−> arising from a use of ‘genericArbitrary’
126+ arising from a use of ‘genericArbitrary’
127+```
126
128
127Here the `TypesDiffer` is a type familty dealing with recursive types and
129Here the `TypesDiffer` is a type familty dealing with recursive types and
128helping us to eliminate inproper instances. To convince the compiller, that the
130helping us to eliminate inproper instances. To convince the compiller, that the
129−`a` parameter is not an `A a` we must fix the instance with additional constraint
131+`a` parameter is not an `A a` we must fix the instance with additional
132+constraint `Arg (A a) a`
130
133
131``` haskell
134``` haskell
132instance (Arg (A a) a, Arbitrary a) => Arbitrary (A a) where
135instance (Arg (A a) a, Arbitrary a) => Arbitrary (A a) where
generic-arbitrary.cabal+1
@@ -15,6 +15,7 @@ homepage: http://github.com/typeable/generic-arbitrary#readme
15category: Generic
15category: Generic
16build-type: Simple
16build-type: Simple
17extra-source-files: CHANGELOG.md
17extra-source-files: CHANGELOG.md
18+ , README.md
18cabal-version: 1.22
19cabal-version: 1.22
19tested-with: GHC == 8.10.7
20tested-with: GHC == 8.10.7
20 , GHC == 9.0.2
21 , GHC == 9.0.2
src/Test/QuickCheck/Arbitrary/Generic.hs+1−1
@@ -127,7 +127,6 @@ Now everything compiles and works as expected.
127module Test.QuickCheck.Arbitrary.Generic
127module Test.QuickCheck.Arbitrary.Generic
128 ( -- * Main
128 ( -- * Main
129 genericArbitrary
129 genericArbitrary
130− , genericShrink
131#if MIN_VERSION_QuickCheck(2, 14, 0)
130#if MIN_VERSION_QuickCheck(2, 14, 0)
132 , GenericArbitrary(..)
131 , GenericArbitrary(..)
133#endif
132#endif
@@ -143,6 +142,7 @@ module Test.QuickCheck.Arbitrary.Generic
143 , SumLen
142 , SumLen
144 -- * Reexports
143 -- * Reexports
145 , Arbitrary(..)
144 , Arbitrary(..)
145+ , genericShrink
146 ) where
146 ) where
147
147
148import Control.Applicative
148import Control.Applicative