Skip to content

Commit 72f7f0e

Browse files
committed
Change conditionals in .cabal file to use base version
... instead of GHC version. We care about the base library version, the compiler versions is irrelevant.
1 parent bc0a3e2 commit 72f7f0e

5 files changed

Lines changed: 33 additions & 20 deletions

File tree

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.4.3
2+
3+
- Use automatic flags for compatibility conditionals
4+
15
# 0.4.1.1
26

37
- Support GHC-7.2 and GHC-7.0.

OneTuple.cabal

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22
name: OneTuple
3-
version: 0.4.2.1
3+
version: 0.4.3
44
synopsis: Singleton Tuple
55
category: Data
66
description:
@@ -40,6 +40,16 @@ source-repository head
4040
type: git
4141
location: https://github.com/phadej/OneTuple.git
4242

43+
flag base-ge-4-15
44+
description: @base >=4.15@ (GHC-9.0)
45+
default: True
46+
manual: False
47+
48+
flag base-ge-4-16
49+
description: @base >=4.16@ (GHC-9.2)
50+
default: True
51+
manual: False
52+
4353
library
4454
default-language: Haskell98
4555
exposed-modules:
@@ -52,17 +62,31 @@ library
5262
base >=4.12 && <4.23
5363
, template-haskell
5464

55-
if impl(ghc >=9.0)
65+
if flag(base-ge-4-15)
5666
build-depends: ghc-prim
67+
5768
else
5869
build-depends: hashable >=1.3.5.0 && <1.6
5970

60-
if !impl(ghc >=9.0)
71+
if !flag(base-ge-4-15)
6172
build-depends: foldable1-classes-compat >=0.1 && <0.2
6273

63-
if !impl(ghc >=9.2)
74+
if !flag(base-ge-4-16)
6475
build-depends: base-orphans >=0.8.6
6576

77+
-- flag selection forcing conditionals
78+
if flag(base-ge-4-15)
79+
build-depends: base >=4.15
80+
81+
else
82+
build-depends: base <4.15
83+
84+
if flag(base-ge-4-16)
85+
build-depends: base >=4.16
86+
87+
else
88+
build-depends: base <4.16
89+
6690
test-suite instances
6791
type: exitcode-stdio-1.0
6892
default-language: Haskell98

src/Data/Tuple/OneTuple.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
{-# LANGUAGE CPP #-}
2-
#if __GLASGOW_HASKELL__ >= 708
31
{-# LANGUAGE PatternSynonyms #-}
4-
#endif
52
-- | This is a module to help migration from @OneTuple@ to @Solo@.
63
-- Migrate to use "Data.Tuple" from @base-4.16@ or "Data.Tuple.Solo" with all GHCs.
74
--
@@ -10,9 +7,7 @@ module Data.Tuple.OneTuple
107
{-# DEPRECATED "Use Data.Tuple.Solo" #-}
118
(
129
OneTuple,
13-
#if __GLASGOW_HASKELL__ >= 708
1410
pattern OneTuple,
15-
#endif
1611
only,
1712
) where
1813

@@ -23,13 +18,7 @@ type OneTuple = Solo
2318
only :: OneTuple a -> a
2419
only = getSolo
2520

26-
#if __GLASGOW_HASKELL__ >= 708
27-
#if __GLASGOW_HASKELL__ >= 710
2821
pattern OneTuple :: a -> Solo a
29-
#endif
3022
pattern OneTuple a = MkSolo a
31-
#endif
3223

33-
#if __GLASGOW_HASKELL__ >= 800
3424
{-# COMPLETE OneTuple #-}
35-
#endif

src/Data/Tuple/Solo.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pattern MkSolo a = Solo a
5454

5555
{-# COMPLETE MkSolo #-}
5656

57+
-- !MIN_VERSION_base(4,15,0)
5758
#else
5859

5960
import Control.Applicative (Applicative (..))

test/instances.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{-# LANGUAGE CPP #-}
2-
#if __GLASGOW_HASKELL__ >= 800
32
{-# OPTIONS_GHC -Wincomplete-patterns -Werror=incomplete-patterns #-}
4-
#else
53
{-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-}
6-
#endif
74
module Main where
85

96
import Control.Applicative (Applicative (..))
@@ -66,9 +63,7 @@ hasApplicative :: Applicative f => f a -> f a; hasApplicative x = x; testApplica
6663
hasMonad :: Monad f => f a -> f a; hasMonad x = x; testMonad = hasMonad tup1
6764
hasMonadFix :: MonadFix f => f a -> f a; hasMonadFix x = x; testMonadFix = hasMonadFix tup1
6865

69-
#if MIN_VERSION_base(4,4,0)
7066
hasMonadZip :: MonadZip f => f a -> f a; hasMonadZip x = x; testMonadZip = hasMonadZip tup1
71-
#endif
7267

7368
hasEq1 :: Eq1 f => f a -> f a; hasEq1 x = x; testEq1 = hasEq1 tup1
7469
hasOrd1 :: Ord1 f => f a -> f a; hasOrd1 x = x; testOrd1 = hasOrd1 tup1

0 commit comments

Comments
 (0)