diff --git a/base-compat-batteries/CHANGES.markdown b/base-compat-batteries/CHANGES.markdown index df5620c..84500cb 100644 --- a/base-compat-batteries/CHANGES.markdown +++ b/base-compat-batteries/CHANGES.markdown @@ -5,6 +5,10 @@ - Require `OneTuple-0.4` or later on GHC 7.4+, as that is the first `OneTuple` release to backport the `MkSolo` data constuctor for `Solo`. See `Data.Tuple.Compat`. + - Introduce `Data.Foldable1.Compat` and `Data.Bifoldable1.Compat` modules, + which correspond to changes made in `base-4.18.0.0`. `base-compat-batteries` + uses the `foldable1-classes-compat` library to backport this code to older + versions of `base`. - Depend on `bifunctor-classes-compat` to backport the `Bifunctor`, `Bifoldable`, and `Bitraversable` classes instead of the `bifunctors` library, which has more dependencies. diff --git a/base-compat-batteries/base-compat-batteries.cabal b/base-compat-batteries/base-compat-batteries.cabal index cc0cb4a..72ba89c 100644 --- a/base-compat-batteries/base-compat-batteries.cabal +++ b/base-compat-batteries/base-compat-batteries.cabal @@ -72,7 +72,8 @@ library contravariant >= 1.5 && < 1.6 if !impl(ghc >= 9.6) build-depends: - OneTuple >= 0.4 && < 0.5 + foldable1-classes-compat >= 0.1 && < 0.2, + OneTuple >= 0.4 && < 0.5 ghc-options: -fno-warn-duplicate-exports if impl(ghc >= 7.10) @@ -91,6 +92,7 @@ library Control.Monad.ST.Lazy.Unsafe.Compat Control.Monad.ST.Unsafe.Compat Data.Bifoldable.Compat + Data.Bifoldable1.Compat Data.Bifunctor.Compat Data.Bitraversable.Compat Data.Bits.Compat @@ -98,6 +100,7 @@ library Data.Complex.Compat Data.Either.Compat Data.Foldable.Compat + Data.Foldable1.Compat Data.Function.Compat Data.Functor.Compat Data.Functor.Compose.Compat @@ -155,6 +158,7 @@ library Control.Monad.ST.Lazy.Unsafe.Compat.Repl.Batteries Control.Monad.ST.Unsafe.Compat.Repl.Batteries Data.Bifoldable.Compat.Repl.Batteries + Data.Bifoldable1.Compat.Repl.Batteries Data.Bifunctor.Compat.Repl.Batteries Data.Bitraversable.Compat.Repl.Batteries Data.Bits.Compat.Repl.Batteries @@ -162,6 +166,7 @@ library Data.Complex.Compat.Repl.Batteries Data.Either.Compat.Repl.Batteries Data.Foldable.Compat.Repl.Batteries + Data.Foldable1.Compat.Repl.Batteries Data.Function.Compat.Repl.Batteries Data.Functor.Compat.Repl.Batteries Data.Functor.Compose.Compat.Repl.Batteries diff --git a/base-compat-batteries/src/Data/Bifoldable1/Compat.hs b/base-compat-batteries/src/Data/Bifoldable1/Compat.hs new file mode 100644 index 0000000..b423d80 --- /dev/null +++ b/base-compat-batteries/src/Data/Bifoldable1/Compat.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +module Data.Bifoldable1.Compat ( + module Base +) where + +#if MIN_VERSION_base(4,18,0) +import "base-compat" Data.Bifoldable1.Compat as Base +#else +import "foldable1-classes-compat" Data.Bifoldable1 as Base +#endif diff --git a/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs new file mode 100644 index 0000000..542d1b9 --- /dev/null +++ b/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Bifoldable1.Compat" +-- from a globally unique namespace. +module Data.Bifoldable1.Compat.Repl.Batteries ( + module Data.Bifoldable1.Compat +) where +import "this" Data.Bifoldable1.Compat diff --git a/base-compat-batteries/src/Data/Foldable1/Compat.hs b/base-compat-batteries/src/Data/Foldable1/Compat.hs new file mode 100644 index 0000000..190a63a --- /dev/null +++ b/base-compat-batteries/src/Data/Foldable1/Compat.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +module Data.Foldable1.Compat ( + module Base +) where + +#if MIN_VERSION_base(4,18,0) +import "base-compat" Data.Foldable1.Compat as Base +#else +import "foldable1-classes-compat" Data.Foldable1 as Base +#endif diff --git a/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs new file mode 100644 index 0000000..ee2a2d0 --- /dev/null +++ b/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Foldable1.Compat" +-- from a globally unique namespace. +module Data.Foldable1.Compat.Repl.Batteries ( + module Data.Foldable1.Compat +) where +import "this" Data.Foldable1.Compat diff --git a/base-compat-batteries/test/SafeHaskellSpec.hs b/base-compat-batteries/test/SafeHaskellSpec.hs index 56d3006..3113940 100644 --- a/base-compat-batteries/test/SafeHaskellSpec.hs +++ b/base-compat-batteries/test/SafeHaskellSpec.hs @@ -14,6 +14,7 @@ import Control.Monad.Compat () import Control.Monad.Fail.Compat () import Control.Monad.IO.Class.Compat () import Data.Bifoldable.Compat () +import Data.Bifoldable1.Compat () import Data.Bifunctor.Compat () import Data.Bitraversable.Compat () import Data.Bits.Compat () @@ -21,6 +22,7 @@ import Data.Bool.Compat () import Data.Complex.Compat () import Data.Either.Compat () import Data.Foldable.Compat () +import Data.Foldable1.Compat () import Data.Function.Compat () import Data.Functor.Compat () import Data.Functor.Compose.Compat () diff --git a/base-compat/CHANGES.markdown b/base-compat/CHANGES.markdown index a60cb82..abcc7d6 100644 --- a/base-compat/CHANGES.markdown +++ b/base-compat/CHANGES.markdown @@ -18,6 +18,10 @@ - Backport `heqT` to `Data.Typeable.Compat`. Note that `heqT` is only defined when building with `base-4.10` or later, as that is the first version of `base` to provide the primitives needed to define `heqT`. + - Introduce `Data.Foldable1.Compat` and `Data.Bifoldable1.Compat` modules, + which correspond to changes made in `base-4.18.0.0`. You may consider using + `base-compat-batteries` instead if you want increase the range of `base` + versions that are supported. ## Changes in 0.12.2 [2022.08.11] - Sync with `base-4.17`/GHC 9.4 diff --git a/base-compat/README.markdown b/base-compat/README.markdown index 14fa5dd..5f7ad2d 100644 --- a/base-compat/README.markdown +++ b/base-compat/README.markdown @@ -279,6 +279,10 @@ on, paired with the things that each library backports: * [`fail`](http://hackage.haskell.org/package/fail) for the [`MonadFail`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad-Fail.html#t:MonadFail) type class, introduced in `base-4.9.0.0` +* [`foldable1-classes-compat`](https://hackage.haskell.org/package/foldable1-classes-compat) + for the [`Foldable1`](https://hackage.haskell.org/package/foldable1-classes-compat-0.1/docs/Data-Foldable1.html#t:Foldable1) + and [`Bifoldable1`](https://hackage.haskell.org/package/foldable1-classes-compat-0.1/docs/Data-Bifoldable1.html#t:Bifoldable1) + type classes, introduced in `base-4.18.0.0` * [`nats`](http://hackage.haskell.org/package/nats) for the [`Natural`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Numeric-Natural.html) data type, introduced in `base-4.8.0.0` diff --git a/base-compat/base-compat.cabal b/base-compat/base-compat.cabal index d0f2c7f..0ac17a3 100644 --- a/base-compat/base-compat.cabal +++ b/base-compat/base-compat.cabal @@ -78,6 +78,7 @@ library Control.Monad.ST.Lazy.Unsafe.Compat Control.Monad.ST.Unsafe.Compat Data.Bifoldable.Compat + Data.Bifoldable1.Compat Data.Bifunctor.Compat Data.Bitraversable.Compat Data.Bits.Compat @@ -85,6 +86,7 @@ library Data.Complex.Compat Data.Either.Compat Data.Foldable.Compat + Data.Foldable1.Compat Data.Function.Compat Data.Functor.Compat Data.Functor.Compose.Compat @@ -142,6 +144,7 @@ library Control.Monad.ST.Lazy.Unsafe.Compat.Repl Control.Monad.ST.Unsafe.Compat.Repl Data.Bifoldable.Compat.Repl + Data.Bifoldable1.Compat.Repl Data.Bifunctor.Compat.Repl Data.Bitraversable.Compat.Repl Data.Bits.Compat.Repl @@ -149,6 +152,7 @@ library Data.Complex.Compat.Repl Data.Either.Compat.Repl Data.Foldable.Compat.Repl + Data.Foldable1.Compat.Repl Data.Function.Compat.Repl Data.Functor.Compat.Repl Data.Functor.Compose.Compat.Repl diff --git a/base-compat/src/Data/Bifoldable1/Compat.hs b/base-compat/src/Data/Bifoldable1/Compat.hs new file mode 100644 index 0000000..51b9cd9 --- /dev/null +++ b/base-compat/src/Data/Bifoldable1/Compat.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE CPP, NoImplicitPrelude #-} +module Data.Bifoldable1.Compat ( +#if MIN_VERSION_base(4,18,0) + module Base +#endif +) where + +#if MIN_VERSION_base(4,18,0) +import Data.Bifoldable1 as Base +#endif diff --git a/base-compat/src/Data/Bifoldable1/Compat/Repl.hs b/base-compat/src/Data/Bifoldable1/Compat/Repl.hs new file mode 100644 index 0000000..69b230a --- /dev/null +++ b/base-compat/src/Data/Bifoldable1/Compat/Repl.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Bifoldable1.Compat" +-- from a globally unique namespace. +module Data.Bifoldable1.Compat.Repl ( + module Data.Bifoldable1.Compat +) where +import "this" Data.Bifoldable1.Compat diff --git a/base-compat/src/Data/Foldable1/Compat.hs b/base-compat/src/Data/Foldable1/Compat.hs new file mode 100644 index 0000000..de2fbd1 --- /dev/null +++ b/base-compat/src/Data/Foldable1/Compat.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE CPP, NoImplicitPrelude #-} +module Data.Foldable1.Compat ( +#if MIN_VERSION_base(4,18,0) + module Base +#endif +) where + +#if MIN_VERSION_base(4,18,0) +import Data.Foldable1 as Base +#endif diff --git a/base-compat/src/Data/Foldable1/Compat/Repl.hs b/base-compat/src/Data/Foldable1/Compat/Repl.hs new file mode 100644 index 0000000..21a4d79 --- /dev/null +++ b/base-compat/src/Data/Foldable1/Compat/Repl.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Foldable1.Compat" +-- from a globally unique namespace. +module Data.Foldable1.Compat.Repl ( + module Data.Foldable1.Compat +) where +import "this" Data.Foldable1.Compat