From cfc6f92a890f0989872d44006e4646e268295fd2 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Sat, 11 Nov 2017 17:43:53 +0000 Subject: [PATCH] only define Arbitrary for ListN when available --- Foundation/Check/Arbitrary.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Foundation/Check/Arbitrary.hs b/Foundation/Check/Arbitrary.hs index c0d9b678..9225dfc8 100644 --- a/Foundation/Check/Arbitrary.hs +++ b/Foundation/Check/Arbitrary.hs @@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE CPP #-} module Foundation.Check.Arbitrary ( Arbitrary(..) , frequency @@ -19,7 +20,9 @@ import Basement.Types.OffsetSize import qualified Basement.Types.Char7 as Char7 import Basement.Types.Word128 (Word128(..)) import Basement.Types.Word256 (Word256(..)) +#if __GLASGOW_HASKELL__ >= 710 import qualified Basement.Sized.List as ListN +#endif import Foundation.Check.Gen import Foundation.Random import Foundation.Bits @@ -114,8 +117,10 @@ instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbit instance Arbitrary a => Arbitrary [a] where arbitrary = genWithParams $ \params -> fromList <$> (genMax (genMaxSizeArray params) >>= \i -> replicateM (integralCast i) arbitrary) +#if __GLASGOW_HASKELL__ >= 710 instance (Arbitrary a, KnownNat n, NatWithinBound Int n) => Arbitrary (ListN.ListN n a) where arbitrary = ListN.replicateM arbitrary +#endif arbitraryInteger :: Gen Integer arbitraryInteger =