Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
only define Arbitrary for ListN when available
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenthz committed Nov 11, 2017
1 parent 102b3ad commit cfc6f92
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Foundation/Check/Arbitrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}
module Foundation.Check.Arbitrary
( Arbitrary(..)
, frequency
Expand All @@ -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
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit cfc6f92

Please sign in to comment.