diff --git a/Changelog.md b/Changelog.md index 3254c1f..8efc2a1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +# 0.4.3 + +- Use automatic flags for compatibility conditionals + # 0.4.1.1 - Support GHC-7.2 and GHC-7.0. diff --git a/OneTuple.cabal b/OneTuple.cabal index 86f2e50..0f4e9ed 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 name: OneTuple -version: 0.4.2.1 +version: 0.4.3 synopsis: Singleton Tuple category: Data description: @@ -40,6 +40,16 @@ source-repository head type: git location: https://github.com/phadej/OneTuple.git +flag base-ge-4-15 + description: @base >=4.15@ (GHC-9.0) + default: True + manual: False + +flag base-ge-4-16 + description: @base >=4.16@ (GHC-9.2) + default: True + manual: False + library default-language: Haskell98 exposed-modules: @@ -52,17 +62,31 @@ library base >=4.12 && <4.23 , template-haskell - if impl(ghc >=9.0) + if flag(base-ge-4-15) build-depends: ghc-prim + else build-depends: hashable >=1.3.5.0 && <1.6 - if !impl(ghc >=9.0) + if !flag(base-ge-4-15) build-depends: foldable1-classes-compat >=0.1 && <0.2 - if !impl(ghc >=9.2) + if !flag(base-ge-4-16) build-depends: base-orphans >=0.8.6 + -- flag selection forcing conditionals + if flag(base-ge-4-15) + build-depends: base >=4.15 + + else + build-depends: base <4.15 + + if flag(base-ge-4-16) + build-depends: base >=4.16 + + else + build-depends: base <4.16 + test-suite instances type: exitcode-stdio-1.0 default-language: Haskell98 diff --git a/src/Data/Tuple/OneTuple.hs b/src/Data/Tuple/OneTuple.hs index ebf9e5b..16e893f 100644 --- a/src/Data/Tuple/OneTuple.hs +++ b/src/Data/Tuple/OneTuple.hs @@ -1,7 +1,4 @@ -{-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE PatternSynonyms #-} -#endif -- | This is a module to help migration from @OneTuple@ to @Solo@. -- Migrate to use "Data.Tuple" from @base-4.16@ or "Data.Tuple.Solo" with all GHCs. -- @@ -10,9 +7,7 @@ module Data.Tuple.OneTuple {-# DEPRECATED "Use Data.Tuple.Solo" #-} ( OneTuple, -#if __GLASGOW_HASKELL__ >= 708 pattern OneTuple, -#endif only, ) where @@ -23,13 +18,7 @@ type OneTuple = Solo only :: OneTuple a -> a only = getSolo -#if __GLASGOW_HASKELL__ >= 708 -#if __GLASGOW_HASKELL__ >= 710 pattern OneTuple :: a -> Solo a -#endif pattern OneTuple a = MkSolo a -#endif -#if __GLASGOW_HASKELL__ >= 800 {-# COMPLETE OneTuple #-} -#endif diff --git a/src/Data/Tuple/Solo.hs b/src/Data/Tuple/Solo.hs index 1814d2b..9861b33 100644 --- a/src/Data/Tuple/Solo.hs +++ b/src/Data/Tuple/Solo.hs @@ -54,6 +54,7 @@ pattern MkSolo a = Solo a {-# COMPLETE MkSolo #-} +-- !MIN_VERSION_base(4,15,0) #else import Control.Applicative (Applicative (..)) diff --git a/test/instances.hs b/test/instances.hs index 322f8f7..c59510f 100644 --- a/test/instances.hs +++ b/test/instances.hs @@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -Wincomplete-patterns -Werror=incomplete-patterns #-} -#else {-# OPTIONS_GHC -fwarn-incomplete-patterns -Werror #-} -#endif module Main where import Control.Applicative (Applicative (..)) @@ -66,9 +63,7 @@ hasApplicative :: Applicative f => f a -> f a; hasApplicative x = x; testApplica hasMonad :: Monad f => f a -> f a; hasMonad x = x; testMonad = hasMonad tup1 hasMonadFix :: MonadFix f => f a -> f a; hasMonadFix x = x; testMonadFix = hasMonadFix tup1 -#if MIN_VERSION_base(4,4,0) hasMonadZip :: MonadZip f => f a -> f a; hasMonadZip x = x; testMonadZip = hasMonadZip tup1 -#endif hasEq1 :: Eq1 f => f a -> f a; hasEq1 x = x; testEq1 = hasEq1 tup1 hasOrd1 :: Ord1 f => f a -> f a; hasOrd1 x = x; testOrd1 = hasOrd1 tup1