diff --git a/src/Constrained/Core.hs b/src/Constrained/Core.hs index e4e14e3..034e174 100644 --- a/src/Constrained/Core.hs +++ b/src/Constrained/Core.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ImportQualifiedPost #-} @@ -7,9 +6,6 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-} --- Arbitrary NonEmpty --- TOOD: fixme by bumping QuickCheck to 3.0 when it's released -{-# OPTIONS_GHC -Wno-orphans #-} -- | This is a collection of relatively core concepts that are re-used -- throughout the codebase. @@ -40,12 +36,6 @@ import Data.Set (Set) import Data.Set qualified as Set import Data.Typeable --- Orphan instance for old QuickCheck versions -#if !MIN_VERSION_QuickCheck(2, 17, 0) -import Data.List.NonEmpty qualified as NE -import Test.QuickCheck (Arbitrary (..), NonEmptyList (NonEmpty)) -#endif - -- Variables -------------------------------------------------------------- -- | Typed, optionally named, variables @@ -140,9 +130,3 @@ instance Typeable c => Show (Evidence c) where unionWithMaybe :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a unionWithMaybe f ma ma' = (f <$> ma <*> ma') <|> ma <|> ma' -#if !MIN_VERSION_QuickCheck(2, 17, 0) -instance Arbitrary a => Arbitrary (NonEmpty a) where - arbitrary = do - NonEmpty xs <- arbitrary - pure (NE.fromList xs) -#endif diff --git a/src/Constrained/Test.hs b/src/Constrained/Test.hs index 355b888..3b78d1d 100644 --- a/src/Constrained/Test.hs +++ b/src/Constrained/Test.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -441,3 +442,12 @@ instance QC.Arbitrary TestableFn where , TestableFn $ AppendW @Int ] shrink _ = [] + +-- Cruft ------------------------------------------------------------------ + +#if !MIN_VERSION_QuickCheck(2, 17, 0) +instance Arbitrary a => Arbitrary (NonEmpty a) where + arbitrary = do + NonEmpty xs <- arbitrary + pure (NE.fromList xs) +#endif