@@ -93,7 +93,7 @@ there is a problem with mutually recursive types.
94# Type parameters
94# Type parameters
96−Now lets see an example of datatype with parameters
96+Now let's see an example of datatype with parameters
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
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:
111−> • Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
112+• Could not deduce (Test.QuickCheck.Arbitrary.Generic.GArbitrary
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’
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`
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