git.iko.soy/typeable/generic-arbitrary
on master help sign in
decrypt
commitd7d90004f4a2aae7b3402c751a3f4980f561132e authorAleksey Uymanov <s9gf4ult@gmail.com> dateThu 4 Aug 2022, 11:00 (4 years ago) parentfae188c
1 file changed+11−11
src/Test/QuickCheck/Arbitrary/Generic.hs+11−11
src/Test/QuickCheck/Arbitrary/Generic.hs+11−11
@@ -101,8 +101,8 @@ class (Finite self a ~ finite) => GArbitrary self a (finite :: Bool) where
101101 gArbitrary :: Proxy self -> QC.Gen (a x)
102102
103103instance
104− ( GArbitrary self (C1 c f) 'True
105− ) => GArbitrary self (D1 t (C1 c f)) 'True where
104+ ( GArbitrary self (M1 C c f) 'True
105+ ) => GArbitrary self (M1 D t (M1 C c f)) 'True where
106106 gArbitrary _ = M1 <$> gArbitrary (Proxy :: Proxy self)
107107
108108-- | The constructor meta information
@@ -110,7 +110,7 @@ instance
110110 ( GArbitrary self f some
111111 , KnownNat (ArgumentsCount f)
112112 , AllFieldsFinal self f ~ some
113− ) => GArbitrary self (C1 c f) some where
113+ ) => GArbitrary self (M1 C c f) some where
114114 gArbitrary _ = M1 <$> scale predNat (gArbitrary (Proxy :: Proxy self))
115115 where
116116 argumentsCount = fromIntegral $ natVal (Proxy :: Proxy (ArgumentsCount f))
@@ -123,14 +123,14 @@ instance GArbitrary self U1 'True where
123123 gArbitrary _ = pure U1
124124
125125-- | Constructor field meta information
126−instance GArbitrary self f some => GArbitrary self (S1 t f) some where
126+instance GArbitrary self f some => GArbitrary self (M1 S t f) some where
127127 gArbitrary _ = M1 <$> gArbitrary (Proxy :: Proxy self)
128128
129129-- | Data of the constructor field
130130instance
131131 ( Arbitrary t
132− , Finite self (Rec0 t) ~ some
133− ) => GArbitrary self (Rec0 t) some where
132+ , Finite self (K1 R t) ~ some
133+ ) => GArbitrary self (K1 R t) some where
134134 gArbitrary _ = K1 <$> arbitrary
135135
136136-- | Product
@@ -146,7 +146,7 @@ instance
146146instance
147147 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
148148 , AllFieldsFinal self f ~ 'False
149− ) => GArbitrary self (D1 t (C1 c f)) 'False where
149+ ) => GArbitrary self (M1 D t (M1 C c f)) 'False where
150150 gArbitrary _ = error "Unreachable"
151151#endif
152152
@@ -154,7 +154,7 @@ instance
154154instance
155155 ( FiniteSum self a b af bf
156156 , GArbitrary self (a :+: b) 'True
157− ) => GArbitrary self (D1 t (a :+: b)) 'True where
157+ ) => GArbitrary self (M1 D t (a :+: b)) 'True where
158158 gArbitrary _ = sized $ \s -> M1 <$>
159159 if s > 1
160160 then gArbitrary (Proxy :: Proxy self)
@@ -210,8 +210,8 @@ instance
210210 finiteElem _ = finiteSum (Proxy :: Proxy self)
211211
212212instance
213− ( GArbitrary self (C1 c f) 'True
214− ) => FiniteSumElem self (C1 c f) where
213+ ( GArbitrary self (M1 C c f) 'True
214+ ) => FiniteSumElem self (M1 C c f) where
215215 finiteElem _ = [gArbitrary (Proxy :: Proxy self)]
216216
217217
@@ -219,7 +219,7 @@ instance
219219instance
220220 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
221221 , (Finite self a || Finite self b) ~ 'False
222− ) => GArbitrary self (D1 t (a :+: b)) 'False where
222+ ) => GArbitrary self (M1 D t (a :+: b)) 'False where
223223 gArbitrary _ = error "Unreachable"
224224#endif
225225