@@ -91,12 +91,12 @@ type family SumLen a :: Nat where
9191-- * a: some part of the `Rep self`
9292-- * finite: Is `a` finite? Infinite type has no finite values (like Stream)
9393class (Finite self a ~ finite) => GArbitrary self a (finite :: Bool) where
94− gArbitrary :: QC.Gen (a x)
94+ gArbitrary :: Proxy self -> QC.Gen (a x)
9595
9696instance
9797 ( GArbitrary self (C1 c f) 'True
9898 ) => GArbitrary self (D1 t (C1 c f)) 'True where
99− gArbitrary = M1 <$> gArbitrary @self
99+ gArbitrary _ = M1 <$> gArbitrary (Proxy :: Proxy self)
100100
101101-- | The constructor meta information
102102instance
@@ -104,27 +104,27 @@ instance
104104 , KnownNat (ArgumentsCount f)
105105 , AllFieldsFinal self f ~ some
106106 ) => GArbitrary self (C1 c f) some where
107− gArbitrary = M1 <$> scale predNat (gArbitrary @self)
107+ gArbitrary _ = M1 <$> scale predNat (gArbitrary (Proxy :: Proxy self))
108108 where
109− argumentsCount = fromIntegral $ natVal (Proxy @(ArgumentsCount f))
109+ argumentsCount = fromIntegral $ natVal (Proxy :: Proxy (ArgumentsCount f))
110110 predNat n = max 0 $ if argumentsCount > 1
111111 then n `div` argumentsCount
112112 else pred n
113113
114114-- | Unit type instance
115115instance GArbitrary self U1 'True where
116− gArbitrary = pure U1
116+ gArbitrary _ = pure U1
117117
118118-- | Constructor field meta information
119119instance GArbitrary self f some => GArbitrary self (S1 t f) some where
120− gArbitrary = M1 <$> gArbitrary @self
120+ gArbitrary _ = M1 <$> gArbitrary (Proxy :: Proxy self)
121121
122122-- | Data of the constructor field
123123instance
124124 ( Arbitrary t
125125 , Finite self (Rec0 t) ~ some
126126 ) => GArbitrary self (Rec0 t) some where
127− gArbitrary = K1 <$> arbitrary
127+ gArbitrary _ = K1 <$> arbitrary
128128
129129-- | Product
130130instance
@@ -132,21 +132,24 @@ instance
132132 , GArbitrary self b bf
133133 , (af && bf) ~ some
134134 ) => GArbitrary self (a :*: b) some where
135− gArbitrary = liftA2 (:*:) (gArbitrary @self) (gArbitrary @self)
135+ gArbitrary _ = liftA2 (:*:)
136+ (gArbitrary (Proxy :: Proxy self)) (gArbitrary (Proxy :: Proxy self))
136137
137138instance
138139 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
139140 , AllFieldsFinal self f ~ 'False
140141 ) => GArbitrary self (D1 t (C1 c f)) 'False where
141− gArbitrary = error "Unreachable"
142+ gArbitrary _ = error "Unreachable"
142143
143144-- | ADT declaration with multiple constructors
144145instance
145146 ( FiniteSum self a b af bf
146147 , GArbitrary self (a :+: b) 'True
147148 ) => GArbitrary self (D1 t (a :+: b)) 'True where
148− gArbitrary = sized $ \s -> M1 <$>
149− if s > 1 then gArbitrary @self else oneof (finiteSum @self @a @b)
149+ gArbitrary _ = sized $ \s -> M1 <$>
150+ if s > 1
151+ then gArbitrary (Proxy :: Proxy self)
152+ else oneof (finiteSum (Proxy :: Proxy self))
150153
151154-- | Any sum inside of declaration
152155instance
@@ -154,9 +157,9 @@ instance
154157 , KnownNat (SumLen a), KnownNat (SumLen b)
155158 , (af || bf) ~ some
156159 ) => GArbitrary self (a :+: b) some where
157− gArbitrary = frequency
158− [ (lfreq, G.L1 <$> gArbitrary @self)
159− , (rfreq, G.R1 <$> gArbitrary @self) ]
160+ gArbitrary _ = frequency
161+ [ (lfreq, G.L1 <$> gArbitrary (Proxy :: Proxy self))
162+ , (rfreq, G.R1 <$> gArbitrary (Proxy :: Proxy self)) ]
160163 where
161164 lfreq = fromIntegral $ natVal (Proxy :: Proxy (SumLen a))
162165 rfreq = fromIntegral $ natVal (Proxy :: Proxy (SumLen b))
@@ -164,52 +167,52 @@ instance
164167class
165168 ( Finite self a ~ af, Finite self b ~ bf
166169 ) => FiniteSum self (a :: * -> *) (b :: * -> *) af bf where
167− finiteSum :: [Gen ((a :+: b) p)]
170+ finiteSum :: Proxy self -> [Gen ((a :+: b) p)]
168171
169172instance
170173 ( FiniteSumElem self a, FiniteSumElem self b
171174 , Finite self a ~ 'True
172175 , Finite self b ~ 'True
173176 ) => FiniteSum self a b 'True 'True where
174− finiteSum = concat
175− [ fmap L1 <$> finiteElem @self @a
176− , fmap R1 <$> finiteElem @self @b]
177+ finiteSum _ = concat
178+ [ fmap L1 <$> finiteElem (Proxy :: Proxy self)
179+ , fmap R1 <$> finiteElem (Proxy :: Proxy self)]
177180
178181instance
179182 ( FiniteSumElem self a
180183 , Finite self a ~ 'True
181184 , Finite self b ~ 'False
182185 ) => FiniteSum self a b 'True 'False where
183− finiteSum = fmap L1 <$> finiteElem @self @a
186+ finiteSum _ = fmap L1 <$> finiteElem (Proxy :: Proxy self)
184187
185188instance
186189 ( FiniteSumElem self b
187190 , Finite self a ~ 'False
188191 , Finite self b ~ 'True
189192 ) => FiniteSum self a b 'False 'True where
190− finiteSum = fmap R1 <$> finiteElem @self @b
193+ finiteSum _ = fmap R1 <$> finiteElem (Proxy :: Proxy self)
191194
192195class FiniteSumElem self a where
193− finiteElem :: [Gen (a p)]
196+ finiteElem :: Proxy self -> [Gen (a p)]
194197
195198instance
196199 ( FiniteSum self a b af bf
197200 ) => FiniteSumElem self (a :+: b) where
198− finiteElem = finiteSum @self
201+ finiteElem _ = finiteSum (Proxy :: Proxy self)
199202
200203instance
201204 ( GArbitrary self (C1 c f) 'True
202205 ) => FiniteSumElem self (C1 c f) where
203− finiteElem = [gArbitrary @self]
206+ finiteElem _ = [gArbitrary (Proxy :: Proxy self)]
204207
205208instance
206209 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
207210 , (Finite self a || Finite self b) ~ 'False
208211 ) => GArbitrary self (D1 t (a :+: b)) 'False where
209− gArbitrary = error "Unreachable"
212+ gArbitrary _ = error "Unreachable"
210213
211214genericArbitrary
212215 :: forall a ga some
213216 . (Generic a, GArbitrary a ga some, ga ~ Rep a)
214217 => Gen a
215−genericArbitrary = G.to <$> gArbitrary @a
218+genericArbitrary = G.to <$> gArbitrary (Proxy :: Proxy a)