Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-base-compat for openSUSE:Factory checked in at 2023-06-22 23:25:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-base-compat (Old) and /work/SRC/openSUSE:Factory/.ghc-base-compat.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-base-compat" Thu Jun 22 23:25:15 2023 rev:22 rq:1094420 version:0.13.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-base-compat/ghc-base-compat.changes 2023-04-04 21:18:40.520522844 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-base-compat.new.15902/ghc-base-compat.changes 2023-06-22 23:25:38.385712653 +0200 @@ -1,0 +2,29 @@ +Sat May 27 12:07:35 UTC 2023 - Peter Simons <psim...@suse.com> + +- Update base-compat to version 0.13.0. + ## Changes in 0.13.0 [2023.03.10] + - Sync with `base-4.18`/GHC 9.6 + - Backport `liftA2` being re-exported from `Prelude.Compat`. + - `Data.Tuple.Compat`'s `Solo` API now matches what is present in `Data.Tuple` + in `base-4.18`. In particular, we now re-export both the `MkSolo` and `Solo` + data constructors when building with `ghc-prim-0.10.0` or later, with + `MkSolo` being preferred over `Solo`. If you want to backport `MkSolo` to + earlier versions of GHC, import `Data.Tuple.Compat` from + `base-compat-batteries` instead. + - Backport `traceWith`, `traceShowWith`, and `traceEventWith` to `Debug.Trace`. + Note that `traceEventWith` is only provided when building with `base-4.5` or + later, as that is the first version of `base` to provide the `traceEvent` + primitive on which `traceEventWith` is defined. + - Backport `inits1` and `tails1` to `Data.List.NonEmpty.Compat`. + - Backport `minusNaturalMaybe` to `Numeric.Natural.Compat`. + - Backport `applyWhen` to `Data.Function.Compat`. + - Backport `mapAccumM` and `forAccumM` to `Data.Traversable.Compat`. + - 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. + +------------------------------------------------------------------- Old: ---- base-compat-0.12.2.tar.gz New: ---- base-compat-0.13.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-base-compat.spec ++++++ --- /var/tmp/diff_new_pack.edmJvN/_old 2023-06-22 23:25:39.037715978 +0200 +++ /var/tmp/diff_new_pack.edmJvN/_new 2023-06-22 23:25:39.045716019 +0200 @@ -19,7 +19,7 @@ %global pkg_name base-compat %global pkgver %{pkg_name}-%{version} Name: ghc-%{pkg_name} -Version: 0.12.2 +Version: 0.13.0 Release: 0 Summary: A compatibility layer for base License: MIT ++++++ base-compat-0.12.2.tar.gz -> base-compat-0.13.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/CHANGES.markdown new/base-compat-0.13.0/CHANGES.markdown --- old/base-compat-0.12.2/CHANGES.markdown 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/CHANGES.markdown 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,28 @@ +## Changes in 0.13.0 [2023.03.10] + - Sync with `base-4.18`/GHC 9.6 + - Backport `liftA2` being re-exported from `Prelude.Compat`. + - `Data.Tuple.Compat`'s `Solo` API now matches what is present in `Data.Tuple` + in `base-4.18`. In particular, we now re-export both the `MkSolo` and `Solo` + data constructors when building with `ghc-prim-0.10.0` or later, with + `MkSolo` being preferred over `Solo`. If you want to backport `MkSolo` to + earlier versions of GHC, import `Data.Tuple.Compat` from + `base-compat-batteries` instead. + - Backport `traceWith`, `traceShowWith`, and `traceEventWith` to `Debug.Trace`. + Note that `traceEventWith` is only provided when building with `base-4.5` or + later, as that is the first version of `base` to provide the `traceEvent` + primitive on which `traceEventWith` is defined. + - Backport `inits1` and `tails1` to `Data.List.NonEmpty.Compat`. + - Backport `minusNaturalMaybe` to `Numeric.Natural.Compat`. + - Backport `applyWhen` to `Data.Function.Compat`. + - Backport `mapAccumM` and `forAccumM` to `Data.Traversable.Compat`. + - 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 - Backport `(.^.)`, `(.>>.)`, `(.<<.)`, `(!>>.)`, `(!<<.)`, `oneBits` to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/README.markdown new/base-compat-0.13.0/README.markdown --- old/base-compat-0.12.2/README.markdown 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/README.markdown 2001-09-09 03:46:40.000000000 +0200 @@ -129,7 +129,7 @@ and `cis` in `Data.Complex.Compat` * Added more efficient `maximumBy`/`minimumBy` to `Data.Foldable.Compat` * Added `($>)` and `void` functions to `Data.Functor.Compat` - * `(&)` function to `Data.Function.Compat` + * `(&)` and `applyWhen` functions to `Data.Function.Compat` * `($>)` and `void` functions to `Data.Functor.Compat` * `modifyIORef'`, `atomicModifyIORef'` and `atomicWriteIORef` to `Data.IORef.Compat` * `dropWhileEnd`, `isSubsequenceOf`, `sortOn`, and `uncons` functions to `Data.List.Compat` @@ -139,7 +139,8 @@ * `String`, `lines`, `words`, `unlines`, and `unwords` to `Data.String.Compat` * `gcoerceWith` to `Data.Type.Coercion.Compat` * `makeVersion` function to `Data.Version.Compat` - * `traceId`, `traceShowId`, `traceM`, and `traceShowM` functions to `Debug.Trace.Compat` + * `traceId`, `traceShowId`, `traceM`, `traceShowM`, `traceWith`, + `traceShowWith`, and `traceEventWith` functions to `Debug.Trace.Compat` * `byteSwap16`, `byteSwap32`, and `byteSwap64` to `Data.Word.Compat` * `plusForeignPtr` to `Foreign.ForeignPtr.Compat` * `calloc` and `callocBytes` functions to `Foreign.Marshal.Alloc.Compat` @@ -150,13 +151,18 @@ * `lookupEnv`, `setEnv` and `unsetEnv` to `System.Environment.Compat` * `unsafeFixIO` and `unsafeDupablePerformIO` to `System.IO.Unsafe.IO` * `RuntimeRep`-polymorphic `($!)` to `Prelude.Compat` + * `liftA2` is re-exported from `Prelude.Compat` * `RuntimeRep`-polymorphic `throw` to `Control.Exception.Compat` * `isResourceVanishedError`, `resourceVanishedErrorType`, and `isResourceVanishedErrorType` to `System.IO.Error.Compat` * `singleton` to `Data.List.Compat` and `Data.List.NonEmpty.Compat` + * `inits1` and `tails1` to `Data.List.NonEmpty.Compat` * `hGetContents'`, `getContents'`, and `readFile'` to `System.IO.Compat` * `readBinP` to `Text.Read.Lex.Compat` * `withTypeable` and `pattern TypeRep` to `Type.Reflection.Compat` + * `minusNaturalMaybe` to `Numeric.Natural.Compat` + * `mapAccumM` and `forAccumM` to `Data.Traversable.Compat` + * `heqT` to `Data.Typeable.Compat` ## What is not covered @@ -260,7 +266,7 @@ Here is a list of compatibility libraries that `base-compat-batteries` depends on, paired with the things that each library backports: -* [`bifunctors`](http://hackage.haskell.org/package/bifunctors) +* [`bifunctor-classes-compat`](http://hackage.haskell.org/package/bifunctor-classes-compat) for: * The [`Bifunctor`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Bifunctor.html#t:Bifunctor) type class, introduced in `base-4.8.0.0` @@ -273,6 +279,10 @@ * [`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` @@ -310,8 +320,27 @@ for the [`Void`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Void.html#t:Void) data type, introduced in `base-4.8.0.0` +## Version policy + +This package follows the [Haskell Package Versioning +Policy](https://pvp.haskell.org/). As such, if a new `base-compat` release only +adds new exports, then as a general rule, we will release it with a minor +version bump. Moreover, since `base-compat` does not backport data type or +class definitions (see the "What is not covered" section above), `base-compat` +usually has fewer major version bumps than `base` itself. + +An exception to the general rule about adding new exports is the +`Prelude.Compat` module. If a new `base-compat` release adds any new exports, +then it will _always_ be accompanied by a major version bump, even if there are +no other API changes. This is because of the special nature of +`Prelude.Compat`, which is designed to be imported unqualified. Pre-emptively +bumping the major version number is meant to signal to downstream libraries +that they should check to see if the new `Prelude.Compat` additions will clash +with identifiers of the same names in their code. + ## Supported versions of GHC/`base` + * `ghc-9.6.*` / `base-4.18.*` * `ghc-9.4.*` / `base-4.17.*` * `ghc-9.2.*` / `base-4.16.*` * `ghc-9.0.*` / `base-4.15.*` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/base-compat.cabal new/base-compat-0.13.0/base-compat.cabal --- old/base-compat-0.12.2/base-compat.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/base-compat.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: base-compat -version: 0.12.2 +version: 0.13.0 license: MIT license-file: LICENSE copyright: (c) 2012-2018 Simon Hengel, @@ -78,6 +78,7 @@ 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 @@ Data.Complex.Compat Data.Either.Compat Data.Foldable.Compat + Data.Foldable1.Compat Data.Function.Compat Data.Functor.Compat Data.Functor.Compose.Compat @@ -102,7 +104,9 @@ Data.Semigroup.Compat Data.STRef.Compat Data.String.Compat + Data.Traversable.Compat Data.Tuple.Compat + Data.Typeable.Compat Data.Type.Coercion.Compat Data.Type.Equality.Compat Data.Version.Compat @@ -140,6 +144,7 @@ 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 @@ -147,6 +152,7 @@ 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 @@ -164,7 +170,9 @@ Data.Semigroup.Compat.Repl Data.STRef.Compat.Repl Data.String.Compat.Repl + Data.Traversable.Compat.Repl Data.Tuple.Compat.Repl + Data.Typeable.Compat.Repl Data.Type.Coercion.Compat.Repl Data.Type.Equality.Compat.Repl Data.Version.Compat.Repl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Control/Exception/Compat.hs new/base-compat-0.13.0/src/Control/Exception/Compat.hs --- old/base-compat-0.12.2/src/Control/Exception/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Control/Exception/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,9 +3,13 @@ {-# LANGUAGE Trustworthy #-} #endif #if MIN_VERSION_base(4,10,0) +{-# LANGUAGE DataKinds #-} {-# LANGUAGE MagicHash #-} +{-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} +# if __GLASGOW_HASKELL__ < 806 {-# LANGUAGE TypeInType #-} +# endif #endif module Control.Exception.Compat ( module Base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Bifoldable1/Compat/Repl.hs new/base-compat-0.13.0/src/Data/Bifoldable1/Compat/Repl.hs --- old/base-compat-0.12.2/src/Data/Bifoldable1/Compat/Repl.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Bifoldable1/Compat/Repl.hs 2001-09-09 03:46:40.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Bifoldable1/Compat.hs new/base-compat-0.13.0/src/Data/Bifoldable1/Compat.hs --- old/base-compat-0.12.2/src/Data/Bifoldable1/Compat.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Bifoldable1/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Foldable1/Compat/Repl.hs new/base-compat-0.13.0/src/Data/Foldable1/Compat/Repl.hs --- old/base-compat-0.12.2/src/Data/Foldable1/Compat/Repl.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Foldable1/Compat/Repl.hs 2001-09-09 03:46:40.000000000 +0200 @@ -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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Foldable1/Compat.hs new/base-compat-0.13.0/src/Data/Foldable1/Compat.hs --- old/base-compat-0.12.2/src/Data/Foldable1/Compat.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Foldable1/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Function/Compat.hs new/base-compat-0.13.0/src/Data/Function/Compat.hs --- old/base-compat-0.12.2/src/Data/Function/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Data/Function/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -2,9 +2,14 @@ module Data.Function.Compat ( module Base , (&) +, applyWhen ) where import Data.Function as Base +#if !(MIN_VERSION_base(4,18,0)) +import Prelude.Compat +#endif + #if !(MIN_VERSION_base(4,8,0)) infixl 1 & @@ -17,3 +22,32 @@ x & f = f x #endif + +#if !(MIN_VERSION_base(4,18,0)) +-- | 'applyWhen' applies a function to a value if a condition is true, +-- otherwise, it returns the value unchanged. +-- +-- It is equivalent to @'flip' ('Data.Bool.bool' 'id')@. +-- +-- Algebraic properties: +-- +-- * @applyWhen 'True' = 'id'@ +-- +-- * @applyWhen 'False' f = 'id'@ +-- +-- /Since: 4.18.0.0/ +applyWhen :: Bool -> (a -> a) -> a -> a +applyWhen True f x = f x +applyWhen False _ x = x +-- Proofs: +-- +-- flip bool id = \q f -> bool id f q +-- = \f q -> case q of +-- True -> f = \x -> f x +-- False -> id = \x -> x â +-- +-- applyWhen True = \f x -> f x +-- = \f -> \x -> f x = \f -> f = id â +-- +-- applyWhen False f = \x -> x = id â +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/List/NonEmpty/Compat.hs new/base-compat-0.13.0/src/Data/List/NonEmpty/Compat.hs --- old/base-compat-0.12.2/src/Data/List/NonEmpty/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Data/List/NonEmpty/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -7,81 +7,131 @@ NonEmpty(..) -- * Non-empty stream transformations - , map - , intersperse - , scanl - , scanr - , scanl1 - , scanr1 - , transpose - , sortBy - , sortWith + , map + , intersperse + , scanl + , scanr + , scanl1 + , scanr1 + , transpose + , sortBy + , sortWith -- * Basic functions - , length - , head - , tail - , last - , init + , length + , head + , tail + , last + , init , singleton - , (<|), cons - , uncons - , unfoldr - , sort - , reverse - , inits - , tails + , (<|), cons + , uncons + , unfoldr + , sort + , reverse + , inits + , inits1 + , tails + , tails1 -- * Building streams - , iterate - , repeat - , cycle - , unfold - , insert - , some1 + , iterate + , repeat + , cycle + , unfold + , insert + , some1 -- * Extracting sublists - , take - , drop - , splitAt - , takeWhile - , dropWhile - , span - , break - , filter - , partition - , group - , groupBy - , groupWith - , groupAllWith - , group1 - , groupBy1 - , groupWith1 - , groupAllWith1 + , take + , drop + , splitAt + , takeWhile + , dropWhile + , span + , break + , filter + , partition + , group + , groupBy + , groupWith + , groupAllWith + , group1 + , groupBy1 + , groupWith1 + , groupAllWith1 -- * Sublist predicates - , isPrefixOf + , isPrefixOf -- * \"Set\" operations - , nub - , nubBy + , nub + , nubBy -- * Indexing streams - , (!!) + , (!!) -- * Zipping and unzipping streams - , zip - , zipWith - , unzip + , zip + , zipWith + , unzip -- * Converting to and from a list - , fromList - , toList - , nonEmpty - , xor + , fromList + , toList + , nonEmpty + , xor #endif ) where #if MIN_VERSION_base(4,9,0) import Data.List.NonEmpty + +# if !(MIN_VERSION_base(4,18,0)) +import qualified Prelude.Compat as Prelude +import Prelude.Compat ((.)) + +import qualified Data.Foldable.Compat as Foldable +import qualified Data.List.Compat as List +# endif #endif -#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,15,0)) +#if MIN_VERSION_base(4,9,0) +# if !(MIN_VERSION_base(4,15,0)) -- | Construct a 'NonEmpty' list from a single element. -- -- /Since: 4.15/ singleton :: a -> NonEmpty a singleton a = a :| [] +# endif + +# if !(MIN_VERSION_base(4,18,0)) +-- | The 'inits1' function takes a 'NonEmpty' stream @xs@ and returns all the +-- 'NonEmpty' finite prefixes of @xs@, starting with the shortest. +-- +-- > inits1 (1 :| [2,3]) == (1 :| []) :| [1 :| [2], 1 :| [2,3]] +-- > inits1 (1 :| []) == (1 :| []) :| [] +-- +-- /Since: 4.18/ +inits1 :: NonEmpty a -> NonEmpty (NonEmpty a) +inits1 = + -- fromList is an unsafe function, but this usage should be safe, since: + -- - `inits xs = [[], ..., init (init xs), init xs, xs]` + -- - If `xs` is nonempty, it follows that `inits xs` contains at least one nonempty + -- list, since `last (inits xs) = xs`. + -- - The only empty element of `inits xs` is the first one (by the definition of `inits`) + -- - Therefore, if we take all but the first element of `inits xs` i.e. + -- `tail (inits xs)`, we have a nonempty list of nonempty lists + fromList . Prelude.map fromList . List.tail . List.inits . Foldable.toList + +-- | The 'tails1' function takes a 'NonEmpty' stream @xs@ and returns all the +-- non-empty suffixes of @xs@, starting with the longest. +-- +-- > tails1 (1 :| [2,3]) == (1 :| [2,3]) :| [2 :| [3], 3 :| []] +-- > tails1 (1 :| []) == (1 :| []) :| [] +-- +-- /Since: 4.18/ +tails1 :: NonEmpty a -> NonEmpty (NonEmpty a) +tails1 = + -- fromList is an unsafe function, but this usage should be safe, since: + -- - `tails xs = [xs, tail xs, tail (tail xs), ..., []]` + -- - If `xs` is nonempty, it follows that `tails xs` contains at least one nonempty + -- list, since `head (tails xs) = xs`. + -- - The only empty element of `tails xs` is the last one (by the definition of `tails`) + -- - Therefore, if we take all but the last element of `tails xs` i.e. + -- `init (tails xs)`, we have a nonempty list of nonempty lists + fromList . Prelude.map fromList . List.init . List.tails . Foldable.toList +# endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Traversable/Compat/Repl.hs new/base-compat-0.13.0/src/Data/Traversable/Compat/Repl.hs --- old/base-compat-0.12.2/src/Data/Traversable/Compat/Repl.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Traversable/Compat/Repl.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Traversable.Compat" +-- from a globally unique namespace. +module Data.Traversable.Compat.Repl ( + module Data.Traversable.Compat +) where +import "this" Data.Traversable.Compat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Traversable/Compat.hs new/base-compat-0.13.0/src/Data/Traversable/Compat.hs --- old/base-compat-0.12.2/src/Data/Traversable/Compat.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Traversable/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,109 @@ +{-# LANGUAGE CPP, NoImplicitPrelude #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} +#endif +#if !(MIN_VERSION_base(4,18,0)) +{-# LANGUAGE ScopedTypeVariables #-} +#endif +module Data.Traversable.Compat ( + module Base +, mapAccumM +, forAccumM +) where + +import Data.Traversable as Base + +#if !(MIN_VERSION_base(4,18,0)) +import Prelude.Compat + +import Control.Monad.Compat (liftM) + +# if MIN_VERSION_base(4,8,0) +import Data.Coerce (Coercible, coerce) +# else +import Unsafe.Coerce (unsafeCoerce) +# endif +#endif + +#if !(MIN_VERSION_base(4,18,0)) +-- | A state transformer monad parameterized by the state and inner monad. +-- The implementation is copied from the transformers package with the +-- return tuple swapped. +-- +-- /Since: 4.18.0.0/ +newtype StateT s m a = StateT { runStateT :: s -> m (s, a) } + +-- | /Since: 4.18.0.0/ +instance Monad m => Functor (StateT s m) where + fmap = liftM + {-# INLINE fmap #-} + +-- | /Since: 4.18.0.0/ +instance Monad m => Applicative (StateT s m) where + pure a = StateT $ \ s -> return (s, a) + {-# INLINE pure #-} + StateT mf <*> StateT mx = StateT $ \ s -> do + (s', f) <- mf s + (s'', x) <- mx s' + return (s'', f x) + {-# INLINE (<*>) #-} + m *> k = m >>= \_ -> k + {-# INLINE (*>) #-} + +# if MIN_VERSION_base(4,8,0) +(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c) +(#.) _f = coerce +# else +(#.) :: (b -> c) -> (a -> b) -> (a -> c) +(#.) _f = unsafeCoerce +# endif + +-- | /Since: 4.18.0.0/ +instance (Monad m) => Monad (StateT s m) where + m >>= k = StateT $ \ s -> do + (s', a) <- runStateT m s + runStateT (k a) s' + {-# INLINE (>>=) #-} +# if !(MIN_VERSION_base(4,11,0)) + return = pure +# endif + +-- | The `mapAccumM` function behaves like a combination of `mapM` and +-- `mapAccumL` that traverses the structure while evaluating the actions +-- and passing an accumulating parameter from left to right. +-- It returns a final value of this accumulator together with the new structure. +-- The accummulator is often used for caching the intermediate results of a computation. +-- +-- @since 4.18.0.0 +-- +-- ==== __Examples__ +-- +-- Basic usage: +-- +-- >>> let expensiveDouble a = putStrLn ("Doubling " <> show a) >> pure (2 * a) +-- >>> :{ +-- mapAccumM (\cache a -> case lookup a cache of +-- Nothing -> expensiveDouble a >>= \double -> pure ((a, double):cache, double) +-- Just double -> pure (cache, double) +-- ) [] [1, 2, 3, 1, 2, 3] +-- :} +-- Doubling 1 +-- Doubling 2 +-- Doubling 3 +-- ([(3,6),(2,4),(1,2)],[2,4,6,2,4,6]) +-- +mapAccumM + :: forall m t s a b. (Monad m, Traversable t) + => (s -> a -> m (s, b)) + -> s -> t a -> m (s, t b) +mapAccumM f s t = runStateT (mapM (StateT #. flip f) t) s + +-- | 'forAccumM' is 'mapAccumM' with the arguments rearranged. +-- +-- @since 4.18.0.0 +forAccumM + :: (Monad m, Traversable t) + => s -> t a -> (s -> a -> m (s, b)) -> m (s, t b) +{-# INLINE forAccumM #-} +forAccumM s t f = mapAccumM f s t +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Tuple/Compat.hs new/base-compat-0.13.0/src/Data/Tuple/Compat.hs --- old/base-compat-0.12.2/src/Data/Tuple/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Data/Tuple/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -2,14 +2,23 @@ #if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif +#if MIN_VERSION_ghc_prim(0,7,0) +{-# LANGUAGE PatternSynonyms #-} +#endif +-- | Note that we only re-export @MkSolo@ when building with @ghc-prim-0.10.0@ +-- (bundled with GHC 9.6) or later. If you want to backport @MkSolo@ to older +-- versions of GHC, import @Data.Tuple.Compat@ from @base-compat-batteries@ +-- instead. module Data.Tuple.Compat ( fst , snd , curry , uncurry , swap -#if MIN_VERSION_ghc_prim(0,7,0) - , Solo(..) +#if MIN_VERSION_ghc_prim(0,10,0) + , Solo(MkSolo,Solo) +#elif MIN_VERSION_ghc_prim(0,7,0) + , Solo(Solo) #endif ) where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Typeable/Compat/Repl.hs new/base-compat-0.13.0/src/Data/Typeable/Compat/Repl.hs --- old/base-compat-0.12.2/src/Data/Typeable/Compat/Repl.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Typeable/Compat/Repl.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,8 @@ +{-# LANGUAGE PackageImports #-} +{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +-- | Reexports "Data.Typeable.Compat" +-- from a globally unique namespace. +module Data.Typeable.Compat.Repl ( + module Data.Typeable.Compat +) where +import "this" Data.Typeable.Compat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Data/Typeable/Compat.hs new/base-compat-0.13.0/src/Data/Typeable/Compat.hs --- old/base-compat-0.12.2/src/Data/Typeable/Compat.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/base-compat-0.13.0/src/Data/Typeable/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP, NoImplicitPrelude #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} +#endif +#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,18,0)) +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} +#endif +module Data.Typeable.Compat ( + module Base +#if MIN_VERSION_base(4,10,0) +, heqT +#endif +) where + +import Data.Typeable as Base + +#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,18,0)) +import Prelude.Compat + +import qualified Type.Reflection.Compat as TR +#endif + +#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,18,0)) +-- | Extract a witness of heterogeneous equality of two types +-- +-- /Since: 4.18.0.0/ +heqT :: forall a b. (Typeable a, Typeable b) => Maybe (a :~~: b) +heqT = ta `TR.eqTypeRep` tb + where + ta = TR.typeRep :: TR.TypeRep a + tb = TR.typeRep :: TR.TypeRep b +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Debug/Trace/Compat.hs new/base-compat-0.13.0/src/Debug/Trace/Compat.hs --- old/base-compat-0.12.2/src/Debug/Trace/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Debug/Trace/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -5,6 +5,11 @@ , traceShowId , traceM , traceShowM +, traceWith +, traceShowWith +#if MIN_VERSION_base(4,5,0) +, traceEventWith +#endif ) where #if !(MIN_VERSION_base(4,7,0)) || MIN_VERSION_base(4,9,0) @@ -16,7 +21,7 @@ ) #endif -#if !(MIN_VERSION_base(4,9,0)) +#if !(MIN_VERSION_base(4,18,0)) import Prelude.Compat #endif @@ -75,3 +80,39 @@ traceShowM :: (Show a, Applicative f) => a -> f () traceShowM = traceM . show #endif + +#if !(MIN_VERSION_base(4,18,0)) +{-| +Like 'trace', but outputs the result of calling a function on the argument. + +>>> traceWith fst ("hello","world") +hello +("hello","world") + +/Since: 4.18.0.0/ +-} +traceWith :: (a -> String) -> a -> a +traceWith f a = trace (f a) a + +{-| +Like 'traceWith', but uses 'show' on the result of the function to convert it to +a 'String'. + +>>> traceShowWith length [1,2,3] +3 +[1,2,3] + +/Since: 4.18.0.0/ +-} +traceShowWith :: Show b => (a -> b) -> a -> a +traceShowWith f = traceWith (show . f) + +# if MIN_VERSION_base(4,5,0) +-- | Like 'traceEvent', but emits the result of calling a function on its +-- argument. +-- +-- /Since: 4.18.0.0/ +traceEventWith :: (a -> String) -> a -> a +traceEventWith f a = traceEvent (f a) a +# endif +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Numeric/Natural/Compat.hs new/base-compat-0.13.0/src/Numeric/Natural/Compat.hs --- old/base-compat-0.12.2/src/Numeric/Natural/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Numeric/Natural/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,10 +1,18 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} +#endif module Numeric.Natural.Compat ( #if MIN_VERSION_base(4,8,0) module Base +, minusNaturalMaybe #endif ) where #if MIN_VERSION_base(4,8,0) import Numeric.Natural as Base + +# if !(MIN_VERSION_base(4,18,0)) +import GHC.Natural (minusNaturalMaybe) +# endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.12.2/src/Prelude/Compat.hs new/base-compat-0.13.0/src/Prelude/Compat.hs --- old/base-compat-0.12.2/src/Prelude/Compat.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/base-compat-0.13.0/src/Prelude/Compat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -7,8 +7,11 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeInType #-} #endif +#if MIN_VERSION_base(4,17,0) && !(MIN_VERSION_base(4,18,0)) +{-# LANGUAGE ExplicitNamespaces #-} +#endif module Prelude.Compat ( -#if MIN_VERSION_base(4,12,0) +#if MIN_VERSION_base(4,18,0) module Base #else either @@ -133,6 +136,7 @@ , (<*) , (<*>) , pure +, liftA2 , (<$) , fmap , (>>) @@ -271,6 +275,11 @@ , ReadS , ShowS , String + +# if MIN_VERSION_base(4,17,0) +-- The equality types +, type (~) +# endif #endif ) where @@ -286,6 +295,8 @@ # endif ) +import Control.Applicative (liftA2) + #else import Prelude hiding ( @@ -315,11 +326,11 @@ , sum ) +import Control.Applicative import Data.Foldable.Compat import Data.Traversable # if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative import Data.Monoid import Data.Word # endif