@@ -1,6 +1,6 @@
11# generic-arbitrary
22
3−[](https://github.com/typeable/generic-arbitrary/actions/workflows/haskell-ci.yml)
3+[](https://github.com/typeable/generic-arbitrary/actions)
44
55# What?
66
@@ -93,7 +93,7 @@ there is a problem with mutually recursive types.
9393
9494# Type parameters
9595
96−Now let's see an example of datatype with parameters
96+Now lets see an example of datatype with parameters
9797
9898``` haskell
9999data A a = A a
@@ -108,28 +108,25 @@ instance (Arbitrary a) => Arbitrary (A a) where
108108
109109It should work from first glance, but when compile it will throw an error:
110110
111−```
112−• Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
113− (A a)
114− (GHC.Generics.D1
115− ('GHC.Generics.MetaData "A" "ParametersTest" "main" 'False)
116− (GHC.Generics.C1
117− ('GHC.Generics.MetaCons "A" 'GHC.Generics.PrefixI 'False)
118− (GHC.Generics.S1
119− ('GHC.Generics.MetaSel
120− 'Nothing
121− 'GHC.Generics.NoSourceUnpackedness
122− 'GHC.Generics.NoSourceStrictness
123− 'GHC.Generics.DecidedLazy)
124− (GHC.Generics.Rec0 a))))
125− (TypesDiffer (A a) a))
126− arising from a use of ‘genericArbitrary’
127−```
111+> • Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
112+> (A a)
113+> (GHC.Generics.D1
114+> ('GHC.Generics.MetaData "A" "ParametersTest" "main" 'False)
115+> (GHC.Generics.C1
116+> ('GHC.Generics.MetaCons "A" 'GHC.Generics.PrefixI 'False)
117+> (GHC.Generics.S1
118+> ('GHC.Generics.MetaSel
119+> 'Nothing
120+> 'GHC.Generics.NoSourceUnpackedness
121+> 'GHC.Generics.NoSourceStrictness
122+> 'GHC.Generics.DecidedLazy)
123+> (GHC.Generics.Rec0 a))))
124+> (TypesDiffer (A a) a))
125+> arising from a use of ‘genericArbitrary’
128126
129127Here the `TypesDiffer` is a type familty dealing with recursive types and
130128helping us to eliminate inproper instances. To convince the compiller, that the
131−`a` parameter is not an `A a` we must fix the instance with additional
132−constraint `Arg (A a) a`
129+`a` parameter is not an `A a` we must fix the instance with additional constraint
133130
134131``` haskell
135132instance (Arg (A a) a, Arbitrary a) => Arbitrary (A a) where