Skip to content

Commit 70165ea

Browse files
Remove some compat cruft from Core.hs
1 parent 7d7e190 commit 70165ea

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/Constrained/Core.hs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# LANGUAGE CPP #-}
21
{-# LANGUAGE FlexibleInstances #-}
32
{-# LANGUAGE GADTs #-}
43
{-# LANGUAGE ImportQualifiedPost #-}
@@ -7,9 +6,6 @@
76
{-# LANGUAGE StandaloneDeriving #-}
87
{-# LANGUAGE TypeApplications #-}
98
{-# LANGUAGE TypeOperators #-}
10-
-- Arbitrary NonEmpty
11-
-- TOOD: fixme by bumping QuickCheck to 3.0 when it's released
12-
{-# OPTIONS_GHC -Wno-orphans #-}
139

1410
-- | This is a collection of relatively core concepts that are re-used
1511
-- throughout the codebase.
@@ -40,12 +36,6 @@ import Data.Set (Set)
4036
import Data.Set qualified as Set
4137
import Data.Typeable
4238

43-
-- Orphan instance for old QuickCheck versions
44-
#if !MIN_VERSION_QuickCheck(2, 17, 0)
45-
import Data.List.NonEmpty qualified as NE
46-
import Test.QuickCheck (Arbitrary (..), NonEmptyList (NonEmpty))
47-
#endif
48-
4939
-- Variables --------------------------------------------------------------
5040

5141
-- | Typed, optionally named, variables
@@ -140,9 +130,3 @@ instance Typeable c => Show (Evidence c) where
140130
unionWithMaybe :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
141131
unionWithMaybe f ma ma' = (f <$> ma <*> ma') <|> ma <|> ma'
142132

143-
#if !MIN_VERSION_QuickCheck(2, 17, 0)
144-
instance Arbitrary a => Arbitrary (NonEmpty a) where
145-
arbitrary = do
146-
NonEmpty xs <- arbitrary
147-
pure (NE.fromList xs)
148-
#endif

src/Constrained/Test.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE DataKinds #-}
23
{-# LANGUAGE FlexibleContexts #-}
34
{-# LANGUAGE FlexibleInstances #-}
@@ -441,3 +442,12 @@ instance QC.Arbitrary TestableFn where
441442
, TestableFn $ AppendW @Int
442443
]
443444
shrink _ = []
445+
446+
-- Cruft ------------------------------------------------------------------
447+
448+
#if !MIN_VERSION_QuickCheck(2, 17, 0)
449+
instance Arbitrary a => Arbitrary (NonEmpty a) where
450+
arbitrary = do
451+
NonEmpty xs <- arbitrary
452+
pure (NE.fromList xs)
453+
#endif

0 commit comments

Comments
 (0)