git.iko.soy/typeable/generic-arbitrary
on master help sign in
compile on 7.10
commitb33b921f97d0450e656922dc675c6b0f628da84e authorAleksey Uymanov <s9gf4ult@gmail.com> dateSun 1 Aug 2021, 23:41 (5 years ago) parent91d1019
2 files changed+9−3
generic-arbitrary.cabal+4−3 src/Test/QuickCheck/Arbitrary/Generic.hs+5
generic-arbitrary.cabal+4−3
@@ -30,20 +30,21 @@ library
3030 hs-source-dirs: src
3131 default-language: Haskell2010
3232 default-extensions: AllowAmbiguousTypes
33+ , CPP
3334 , DataKinds
3435 , DeriveGeneric
36+ , FlexibleContexts
37+ , FlexibleInstances
3538 , GeneralizedNewtypeDeriving
3639 , LambdaCase
37− , FlexibleInstances
38− , FlexibleContexts
3940 , MultiParamTypeClasses
40− , UndecidableInstances
4141 , PolyKinds
4242 , RankNTypes
4343 , ScopedTypeVariables
4444 , TypeFamilies
4545 , TypeOperators
4646 , TypeSynonymInstances
47+ , UndecidableInstances
4748 , ViewPatterns
4849
4950
src/Test/QuickCheck/Arbitrary/Generic.hs+5
@@ -135,11 +135,13 @@ instance
135135 gArbitrary _ = liftA2 (:*:)
136136 (gArbitrary (Proxy :: Proxy self)) (gArbitrary (Proxy :: Proxy self))
137137
138+#if __GLASGOW_HASKELL__ >= 800
138139instance
139140 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
140141 , AllFieldsFinal self f ~ 'False
141142 ) => GArbitrary self (D1 t (C1 c f)) 'False where
142143 gArbitrary _ = error "Unreachable"
144+#endif
143145
144146-- | ADT declaration with multiple constructors
145147instance
@@ -205,11 +207,14 @@ instance
205207 ) => FiniteSumElem self (C1 c f) where
206208 finiteElem _ = [gArbitrary (Proxy :: Proxy self)]
207209
210+
211+#if __GLASGOW_HASKELL__ >= 800
208212instance
209213 ( TypeError (ShowType self :<>: Text " refers to itself in all constructors")
210214 , (Finite self a || Finite self b) ~ 'False
211215 ) => GArbitrary self (D1 t (a :+: b)) 'False where
212216 gArbitrary _ = error "Unreachable"
217+#endif
213218
214219genericArbitrary
215220 :: forall a ga some