From 52769c981fa35d3eac03446ded7b0c8928c347bf Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Sat, 26 Oct 2024 19:01:21 -0400 Subject: [PATCH] Drop support for pre-8.0 versions of GHC Unfortunately, it is no longer possible to reasonably test versions of GHC prior to 8.0 on modern versions of Linux, macOS, or Windows, as these versions of GHC all run into subtle OS incompatibility issues. While we could leave all of the old, pre-8.0 code paths around in `base-compat`, this runs the risk of bitrotting very quickly. As such, I have opted to remove these code paths here. Given that GHC 7.10.3 was released nearly a decade ago, I believe that the risk of breaking anyone's workflows by doing this is very minimal. (It's somewhat unfortunate that we have to drop compatibility like this in an explicitly compatibility-oriented library like `base-compat`, but so be it.) --- .github/workflows/haskell-ci.yml | 126 +++-------- base-compat-batteries/CHANGES.markdown | 6 + .../base-compat-batteries.cabal | 31 +-- .../Concurrent/Compat/Repl/Batteries.hs | 2 +- .../Concurrent/MVar/Compat/Repl/Batteries.hs | 2 +- .../Exception/Compat/Repl/Batteries.hs | 2 +- .../Control/Monad/Compat/Repl/Batteries.hs | 2 +- .../src/Control/Monad/Fail/Compat.hs | 6 +- .../Monad/Fail/Compat/Repl/Batteries.hs | 2 +- .../src/Control/Monad/IO/Class/Compat.hs | 6 +- .../Monad/IO/Class/Compat/Repl/Batteries.hs | 2 +- .../ST/Lazy/Unsafe/Compat/Repl/Batteries.hs | 2 +- .../Monad/ST/Unsafe/Compat/Repl/Batteries.hs | 2 +- .../Data/Bifoldable/Compat/Repl/Batteries.hs | 2 +- .../Data/Bifoldable1/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Bifunctor/Compat.hs | 6 +- .../Data/Bifunctor/Compat/Repl/Batteries.hs | 2 +- .../Bitraversable/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Bits/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Bool/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Complex/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Either/Compat/Repl/Batteries.hs | 2 +- .../Data/Foldable/Compat/Repl/Batteries.hs | 2 +- .../Data/Foldable1/Compat/Repl/Batteries.hs | 2 +- .../Data/Function/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Functor/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Functor/Compose/Compat.hs | 6 +- .../Functor/Compose/Compat/Repl/Batteries.hs | 2 +- .../Functor/Const/Compat/Repl/Batteries.hs | 2 +- .../Contravariant/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Functor/Identity/Compat.hs | 6 +- .../Functor/Identity/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Functor/Product/Compat.hs | 6 +- .../Functor/Product/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Functor/Sum/Compat.hs | 6 +- .../Data/Functor/Sum/Compat/Repl/Batteries.hs | 2 +- .../src/Data/IORef/Compat/Repl/Batteries.hs | 2 +- .../src/Data/List/Compat/Repl/Batteries.hs | 2 +- .../src/Data/List/NonEmpty/Compat.hs | 154 +------------- .../List/NonEmpty/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Monoid/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Proxy/Compat.hs | 6 +- .../src/Data/Proxy/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Ratio/Compat/Repl/Batteries.hs | 2 +- .../src/Data/STRef/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Semigroup/Compat.hs | 6 +- .../Data/Semigroup/Compat/Repl/Batteries.hs | 2 +- .../src/Data/String/Compat/Repl/Batteries.hs | 2 +- .../Data/Traversable/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Tuple/Compat.hs | 14 +- .../src/Data/Tuple/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Type/Coercion/Compat.hs | 6 +- .../Type/Coercion/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Type/Equality/Compat.hs | 26 +-- .../Type/Equality/Compat/Repl/Batteries.hs | 2 +- .../Data/Typeable/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Version/Compat/Repl/Batteries.hs | 2 +- base-compat-batteries/src/Data/Void/Compat.hs | 6 +- .../src/Data/Void/Compat/Repl/Batteries.hs | 2 +- .../src/Data/Word/Compat/Repl/Batteries.hs | 2 +- .../src/Debug/Trace/Compat/Repl/Batteries.hs | 2 +- .../src/Foreign/Compat/Repl/Batteries.hs | 2 +- .../ForeignPtr/Compat/Repl/Batteries.hs | 2 +- .../ForeignPtr/Safe/Compat/Repl/Batteries.hs | 2 +- .../Unsafe/Compat/Repl/Batteries.hs | 2 +- .../Marshal/Alloc/Compat/Repl/Batteries.hs | 2 +- .../Marshal/Array/Compat/Repl/Batteries.hs | 2 +- .../Foreign/Marshal/Compat/Repl/Batteries.hs | 2 +- .../Marshal/Safe/Compat/Repl/Batteries.hs | 2 +- .../Marshal/Unsafe/Compat/Repl/Batteries.hs | 2 +- .../Marshal/Utils/Compat/Repl/Batteries.hs | 2 +- .../src/Numeric/Compat/Repl/Batteries.hs | 2 +- .../src/Numeric/Natural/Compat.hs | 18 +- .../Numeric/Natural/Compat/Repl/Batteries.hs | 2 +- base-compat-batteries/src/Prelude/Compat.hs | 14 +- .../src/Prelude/Compat/Repl/Batteries.hs | 2 +- .../Environment/Compat/Repl/Batteries.hs | 2 +- .../src/System/Exit/Compat/Repl/Batteries.hs | 2 +- .../src/System/IO/Compat/Repl/Batteries.hs | 2 +- .../System/IO/Error/Compat/Repl/Batteries.hs | 2 +- .../System/IO/Unsafe/Compat/Repl/Batteries.hs | 2 +- .../src/Text/Read/Compat/Repl/Batteries.hs | 2 +- .../Text/Read/Lex/Compat/Repl/Batteries.hs | 2 +- .../Type/Reflection/Compat/Repl/Batteries.hs | 2 +- .../test/Data/Bits/CompatSpec.hs | 3 - base-compat-batteries/test/SafeHaskellSpec.hs | 4 +- .../test/System/Environment/CompatSpec.hs | 9 - .../test/TestHspecTrustworthy.hs | 3 - base-compat/CHANGES.markdown | 3 + base-compat/README.markdown | 53 +---- base-compat/base-compat.cabal | 16 +- base-compat/src/Control/Concurrent/Compat.hs | 39 +--- .../src/Control/Concurrent/Compat/Repl.hs | 2 +- .../src/Control/Concurrent/MVar/Compat.hs | 24 +-- .../Control/Concurrent/MVar/Compat/Repl.hs | 2 +- base-compat/src/Control/Exception/Compat.hs | 2 - .../src/Control/Exception/Compat/Repl.hs | 2 +- base-compat/src/Control/Monad/Compat.hs | 188 +---------------- base-compat/src/Control/Monad/Compat/Repl.hs | 2 +- base-compat/src/Control/Monad/Fail/Compat.hs | 6 +- .../src/Control/Monad/Fail/Compat/Repl.hs | 2 +- .../src/Control/Monad/IO/Class/Compat.hs | 6 +- .../src/Control/Monad/IO/Class/Compat/Repl.hs | 2 +- .../Control/Monad/ST/Lazy/Unsafe/Compat.hs | 6 +- .../Monad/ST/Lazy/Unsafe/Compat/Repl.hs | 2 +- .../src/Control/Monad/ST/Unsafe/Compat.hs | 6 +- .../Control/Monad/ST/Unsafe/Compat/Repl.hs | 2 +- .../src/Data/Bifoldable/Compat/Repl.hs | 2 +- .../src/Data/Bifoldable1/Compat/Repl.hs | 2 +- base-compat/src/Data/Bifunctor/Compat.hs | 6 +- base-compat/src/Data/Bifunctor/Compat/Repl.hs | 2 +- .../src/Data/Bitraversable/Compat/Repl.hs | 2 +- base-compat/src/Data/Bits/Compat.hs | 119 +---------- base-compat/src/Data/Bits/Compat/Repl.hs | 2 +- base-compat/src/Data/Bool/Compat.hs | 13 +- base-compat/src/Data/Bool/Compat/Repl.hs | 2 +- base-compat/src/Data/Complex/Compat.hs | 46 +--- base-compat/src/Data/Complex/Compat/Repl.hs | 2 +- base-compat/src/Data/Either/Compat.hs | 18 -- base-compat/src/Data/Either/Compat/Repl.hs | 2 +- base-compat/src/Data/Foldable/Compat.hs | 20 -- base-compat/src/Data/Foldable/Compat/Repl.hs | 2 +- base-compat/src/Data/Foldable1/Compat/Repl.hs | 2 +- base-compat/src/Data/Function/Compat.hs | 13 -- base-compat/src/Data/Function/Compat/Repl.hs | 2 +- base-compat/src/Data/Functor/Compat.hs | 15 -- base-compat/src/Data/Functor/Compat/Repl.hs | 2 +- .../src/Data/Functor/Compose/Compat.hs | 6 +- .../src/Data/Functor/Compose/Compat/Repl.hs | 2 +- .../src/Data/Functor/Const/Compat/Repl.hs | 2 +- .../Data/Functor/Contravariant/Compat/Repl.hs | 2 +- .../src/Data/Functor/Identity/Compat.hs | 6 +- .../src/Data/Functor/Identity/Compat/Repl.hs | 2 +- .../src/Data/Functor/Product/Compat.hs | 6 +- .../src/Data/Functor/Product/Compat/Repl.hs | 2 +- base-compat/src/Data/Functor/Sum/Compat.hs | 6 +- .../src/Data/Functor/Sum/Compat/Repl.hs | 2 +- base-compat/src/Data/IORef/Compat.hs | 35 +--- base-compat/src/Data/IORef/Compat/Repl.hs | 2 +- base-compat/src/Data/List/Compat.hs | 197 ------------------ base-compat/src/Data/List/Compat/Repl.hs | 2 +- base-compat/src/Data/List/NonEmpty/Compat.hs | 22 +- .../src/Data/List/NonEmpty/Compat/Repl.hs | 2 +- base-compat/src/Data/Monoid/Compat.hs | 22 +- base-compat/src/Data/Monoid/Compat/Repl.hs | 2 +- base-compat/src/Data/Proxy/Compat.hs | 8 +- base-compat/src/Data/Proxy/Compat/Repl.hs | 2 +- base-compat/src/Data/Ratio/Compat.hs | 28 +-- base-compat/src/Data/Ratio/Compat/Repl.hs | 2 +- base-compat/src/Data/STRef/Compat.hs | 18 +- base-compat/src/Data/STRef/Compat/Repl.hs | 2 +- base-compat/src/Data/Semigroup/Compat.hs | 6 +- base-compat/src/Data/Semigroup/Compat/Repl.hs | 2 +- base-compat/src/Data/String/Compat.hs | 6 +- base-compat/src/Data/String/Compat/Repl.hs | 2 +- base-compat/src/Data/Traversable/Compat.hs | 11 - .../src/Data/Traversable/Compat/Repl.hs | 2 +- base-compat/src/Data/Tuple/Compat.hs | 2 - base-compat/src/Data/Tuple/Compat/Repl.hs | 2 +- base-compat/src/Data/Type/Coercion/Compat.hs | 6 - .../src/Data/Type/Coercion/Compat/Repl.hs | 2 +- base-compat/src/Data/Type/Equality/Compat.hs | 8 +- .../src/Data/Type/Equality/Compat/Repl.hs | 2 +- base-compat/src/Data/Typeable/Compat.hs | 2 - base-compat/src/Data/Typeable/Compat/Repl.hs | 2 +- base-compat/src/Data/Version/Compat.hs | 12 +- base-compat/src/Data/Version/Compat/Repl.hs | 2 +- base-compat/src/Data/Void/Compat.hs | 6 +- base-compat/src/Data/Void/Compat/Repl.hs | 2 +- base-compat/src/Data/Word/Compat.hs | 35 +--- base-compat/src/Data/Word/Compat/Repl.hs | 2 +- base-compat/src/Debug/Trace/Compat.hs | 67 ------ base-compat/src/Debug/Trace/Compat/Repl.hs | 2 +- base-compat/src/Foreign/Compat.hs | 4 +- base-compat/src/Foreign/Compat/Repl.hs | 2 +- base-compat/src/Foreign/ForeignPtr/Compat.hs | 2 - .../src/Foreign/ForeignPtr/Compat/Repl.hs | 2 +- .../src/Foreign/ForeignPtr/Safe/Compat.hs | 2 - .../Foreign/ForeignPtr/Safe/Compat/Repl.hs | 2 +- .../src/Foreign/ForeignPtr/Unsafe/Compat.hs | 6 +- .../Foreign/ForeignPtr/Unsafe/Compat/Repl.hs | 2 +- .../src/Foreign/Marshal/Alloc/Compat.hs | 37 +--- .../src/Foreign/Marshal/Alloc/Compat/Repl.hs | 2 +- .../src/Foreign/Marshal/Array/Compat.hs | 23 +- .../src/Foreign/Marshal/Array/Compat/Repl.hs | 2 +- base-compat/src/Foreign/Marshal/Compat.hs | 4 +- .../src/Foreign/Marshal/Compat/Repl.hs | 2 +- .../src/Foreign/Marshal/Safe/Compat/Repl.hs | 2 +- .../src/Foreign/Marshal/Unsafe/Compat.hs | 6 +- .../src/Foreign/Marshal/Unsafe/Compat/Repl.hs | 2 +- .../src/Foreign/Marshal/Utils/Compat.hs | 19 +- .../src/Foreign/Marshal/Utils/Compat/Repl.hs | 2 +- base-compat/src/Numeric/Compat.hs | 91 -------- base-compat/src/Numeric/Compat/Repl.hs | 2 +- base-compat/src/Numeric/Natural/Compat.hs | 8 +- .../src/Numeric/Natural/Compat/Repl.hs | 2 +- base-compat/src/Prelude/Compat.hs | 74 +------ base-compat/src/Prelude/Compat/Repl.hs | 2 +- base-compat/src/System/Environment/Compat.hs | 121 +---------- .../src/System/Environment/Compat/Repl.hs | 2 +- base-compat/src/System/Exit/Compat.hs | 15 +- base-compat/src/System/Exit/Compat/Repl.hs | 2 +- base-compat/src/System/IO/Compat/Repl.hs | 2 +- .../src/System/IO/Error/Compat/Repl.hs | 2 +- base-compat/src/System/IO/Unsafe/Compat.hs | 29 +-- .../src/System/IO/Unsafe/Compat/Repl.hs | 2 +- base-compat/src/Text/Read/Compat.hs | 33 +-- base-compat/src/Text/Read/Compat/Repl.hs | 2 +- base-compat/src/Text/Read/Lex/Compat.hs | 2 - base-compat/src/Text/Read/Lex/Compat/Repl.hs | 2 +- base-compat/src/Type/Reflection/Compat.hs | 2 - .../src/Type/Reflection/Compat/Repl.hs | 2 +- cabal.haskell-ci | 18 +- check/lib/Util.hs | 5 - check/test/TypeCheck.hs | 12 +- check/type-check.cabal | 20 +- mk-repl-modules/MkReplModules.hs | 2 +- 217 files changed, 271 insertions(+), 2112 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 6adb3b1..a4837e4 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20240416 +# version: 0.19.20240708 # -# REGENDATA ("0.19.20240416",["github","cabal.project"]) +# REGENDATA ("0.19.20240708",["github","cabal.project"]) # # This file is patched to install the typediff utility from its repository # (see github.yml.patch). @@ -26,14 +26,14 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:bionic + image: buildpack-deps:jammy continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghc-9.10.0.20240413 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.10.0.20240413 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - compiler: ghc-9.8.2 @@ -41,9 +41,9 @@ jobs: compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.5 + - compiler: ghc-9.6.6 compilerKind: ghc - compilerVersion: 9.6.5 + compilerVersion: 9.6.6 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.8 @@ -69,81 +69,39 @@ jobs: - compiler: ghc-8.8.4 compilerKind: ghc compilerVersion: 8.8.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.6.5 compilerKind: ghc compilerVersion: 8.6.5 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.4.4 compilerKind: ghc compilerVersion: 8.4.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.2.2 compilerKind: ghc compilerVersion: 8.2.2 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.0.2 compilerKind: ghc compilerVersion: 8.0.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.10.3 - compilerKind: ghc - compilerVersion: 7.10.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.8.4 - compilerKind: ghc - compilerVersion: 7.8.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.6.3 - compilerKind: ghc - compilerVersion: 7.6.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.4.2 - compilerKind: ghc - compilerVersion: 7.4.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.2.2 - compilerKind: ghc - compilerVersion: 7.2.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.0.4 - compilerKind: ghc - compilerVersion: 7.0.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 - if [ "${{ matrix.setup-method }}" = ghcup ]; then - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -157,27 +115,18 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - else - HC=$HCDIR/bin/$HCKIND - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" - echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 91000)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -206,18 +155,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG < $HOME/.local/bin/typediff chmod a+x $HOME/.local/bin/typediff - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: source - name: initial cabal.project for sdist @@ -286,10 +223,7 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project - fi - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(base-compat|base-compat-batteries|type-check)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(base-compat|base-compat-batteries|type-check)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -297,7 +231,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: restore cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -331,7 +265,7 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: save cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: always() with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} diff --git a/base-compat-batteries/CHANGES.markdown b/base-compat-batteries/CHANGES.markdown index 59d5a15..bd58531 100644 --- a/base-compat-batteries/CHANGES.markdown +++ b/base-compat-batteries/CHANGES.markdown @@ -1,3 +1,9 @@ +## Changes in next [????.??.??] + - This coincides with the `base-compat-batteries-?.??.?` release. Refer to the + [`base-compat-batteries` changelog](https://github.com/haskell-compat/base-compat/blob/master/base-compat-batteries/CHANGES.markdown#changes-in-????-????????) + for more details. + - Drop support for pre-8.0 versions of GHC. + ## Changes in 0.14.0 [2024.04.30] - This coincides with the `base-compat-batteries-0.14.0` release. Refer to the [`base-compat-batteries` changelog](https://github.com/haskell-compat/base-compat/blob/master/base-compat-batteries/CHANGES.markdown#changes-in-0140-20240430) diff --git a/base-compat-batteries/base-compat-batteries.cabal b/base-compat-batteries/base-compat-batteries.cabal index acdf031..1ef2827 100644 --- a/base-compat-batteries/base-compat-batteries.cabal +++ b/base-compat-batteries/base-compat-batteries.cabal @@ -35,13 +35,7 @@ description: Provides functions available in later versions of @base@ to for a more comprehensive list of differences between @base-compat@ and @base-compat-batteries@. extra-source-files: CHANGES.markdown, README.markdown -tested-with: GHC == 7.0.4 - , GHC == 7.2.2 - , GHC == 7.4.2 - , GHC == 7.6.3 - , GHC == 7.8.4 - , GHC == 7.10.3 - , GHC == 8.0.2 +tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 @@ -50,7 +44,7 @@ tested-with: GHC == 7.0.4 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 - , GHC == 9.6.5 + , GHC == 9.6.6 , GHC == 9.8.2 , GHC == 9.10.1 @@ -65,22 +59,9 @@ library default-language: Haskell2010 build-depends: - base >= 4.3 && < 5, + base >= 4.9 && < 5, base-compat == 0.14.0, ghc-prim - if !impl(ghc >= 7.8) - build-depends: - tagged >= 0.8.5 && < 0.9 - if !impl(ghc >= 7.10) - build-depends: - nats >= 1.1.2 && < 1.2, - void >= 0.7.2 && < 0.8 - if !impl(ghc >= 8.0) - build-depends: - fail >= 4.9.0.0 && < 4.10, - semigroups >= 0.18.4 && < 0.21, - transformers >= 0.2 && < 0.7, - transformers-compat >= 0.6 && < 0.8 if !impl(ghc >= 8.2) build-depends: bifunctor-classes-compat >= 0.1 && < 0.2, @@ -93,9 +74,7 @@ library foldable1-classes-compat >= 0.1 && < 0.2, OneTuple >= 0.4 && < 0.5 ghc-options: - -fno-warn-duplicate-exports - if impl(ghc >= 7.10) - ghc-options: -fno-warn-trustworthy-safe + -Wno-duplicate-exports -Wno-trustworthy-safe hs-source-dirs: src @@ -268,7 +247,7 @@ test-suite spec SafeHaskellSpec TestHspecTrustworthy build-depends: - base >= 4.3 && < 5 + base >= 4.9 && < 5 , base-compat-batteries , hspec >= 1.8 , QuickCheck diff --git a/base-compat-batteries/src/Control/Concurrent/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Concurrent/Compat/Repl/Batteries.hs index f613af3..1353547 100644 --- a/base-compat-batteries/src/Control/Concurrent/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Concurrent/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Concurrent.Compat" -- from a globally unique namespace. module Control.Concurrent.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Concurrent/MVar/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Concurrent/MVar/Compat/Repl/Batteries.hs index ed9d3bb..475d113 100644 --- a/base-compat-batteries/src/Control/Concurrent/MVar/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Concurrent/MVar/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Concurrent.MVar.Compat" -- from a globally unique namespace. module Control.Concurrent.MVar.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Exception/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Exception/Compat/Repl/Batteries.hs index ff09029..1f1343a 100644 --- a/base-compat-batteries/src/Control/Exception/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Exception/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Exception.Compat" -- from a globally unique namespace. module Control.Exception.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Monad/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Monad/Compat/Repl/Batteries.hs index 9326271..c8c6ae0 100644 --- a/base-compat-batteries/src/Control/Monad/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Monad/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.Compat" -- from a globally unique namespace. module Control.Monad.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Monad/Fail/Compat.hs b/base-compat-batteries/src/Control/Monad/Fail/Compat.hs index 4a18a83..7c3d160 100644 --- a/base-compat-batteries/src/Control/Monad/Fail/Compat.hs +++ b/base-compat-batteries/src/Control/Monad/Fail/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Control.Monad.Fail.Compat ( module Base ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Control.Monad.Fail.Compat as Base -#else -import "fail" Control.Monad.Fail as Base -#endif diff --git a/base-compat-batteries/src/Control/Monad/Fail/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Monad/Fail/Compat/Repl/Batteries.hs index d3bf57d..fb01a5f 100644 --- a/base-compat-batteries/src/Control/Monad/Fail/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Monad/Fail/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.Fail.Compat" -- from a globally unique namespace. module Control.Monad.Fail.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Monad/IO/Class/Compat.hs b/base-compat-batteries/src/Control/Monad/IO/Class/Compat.hs index ed04624..537d4e0 100644 --- a/base-compat-batteries/src/Control/Monad/IO/Class/Compat.hs +++ b/base-compat-batteries/src/Control/Monad/IO/Class/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Control.Monad.IO.Class.Compat ( module Base ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Control.Monad.IO.Class.Compat as Base -#else -import Control.Monad.IO.Class as Base -#endif diff --git a/base-compat-batteries/src/Control/Monad/IO/Class/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Monad/IO/Class/Compat/Repl/Batteries.hs index 0e2e0d7..be31ba3 100644 --- a/base-compat-batteries/src/Control/Monad/IO/Class/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Monad/IO/Class/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.IO.Class.Compat" -- from a globally unique namespace. module Control.Monad.IO.Class.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl/Batteries.hs index 77d9570..522293e 100644 --- a/base-compat-batteries/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.ST.Lazy.Unsafe.Compat" -- from a globally unique namespace. module Control.Monad.ST.Lazy.Unsafe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Control/Monad/ST/Unsafe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Control/Monad/ST/Unsafe/Compat/Repl/Batteries.hs index 0269e66..ab2d97f 100644 --- a/base-compat-batteries/src/Control/Monad/ST/Unsafe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Control/Monad/ST/Unsafe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.ST.Unsafe.Compat" -- from a globally unique namespace. module Control.Monad.ST.Unsafe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bifoldable/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bifoldable/Compat/Repl/Batteries.hs index 405a365..48db678 100644 --- a/base-compat-batteries/src/Data/Bifoldable/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bifoldable/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifoldable.Compat" -- from a globally unique namespace. module Data.Bifoldable.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs index 542d1b9..08cd4b7 100644 --- a/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bifoldable1/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifoldable1.Compat" -- from a globally unique namespace. module Data.Bifoldable1.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bifunctor/Compat.hs b/base-compat-batteries/src/Data/Bifunctor/Compat.hs index 79a38ec..da77876 100644 --- a/base-compat-batteries/src/Data/Bifunctor/Compat.hs +++ b/base-compat-batteries/src/Data/Bifunctor/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Bifunctor.Compat ( module Base ) where -#if MIN_VERSION_base(4,8,0) import "base-compat" Data.Bifunctor.Compat as Base -#else -import "bifunctor-classes-compat" Data.Bifunctor as Base -#endif diff --git a/base-compat-batteries/src/Data/Bifunctor/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bifunctor/Compat/Repl/Batteries.hs index 8a12628..32c1f86 100644 --- a/base-compat-batteries/src/Data/Bifunctor/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bifunctor/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifunctor.Compat" -- from a globally unique namespace. module Data.Bifunctor.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bitraversable/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bitraversable/Compat/Repl/Batteries.hs index ba2ff1a..d198250 100644 --- a/base-compat-batteries/src/Data/Bitraversable/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bitraversable/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bitraversable.Compat" -- from a globally unique namespace. module Data.Bitraversable.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bits/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bits/Compat/Repl/Batteries.hs index 3cd84df..3f20fac 100644 --- a/base-compat-batteries/src/Data/Bits/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bits/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bits.Compat" -- from a globally unique namespace. module Data.Bits.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Bool/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Bool/Compat/Repl/Batteries.hs index 7a6282e..c552e64 100644 --- a/base-compat-batteries/src/Data/Bool/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Bool/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bool.Compat" -- from a globally unique namespace. module Data.Bool.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Complex/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Complex/Compat/Repl/Batteries.hs index b39a661..0ee125f 100644 --- a/base-compat-batteries/src/Data/Complex/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Complex/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Complex.Compat" -- from a globally unique namespace. module Data.Complex.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Either/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Either/Compat/Repl/Batteries.hs index d6dff1e..f8ce7e4 100644 --- a/base-compat-batteries/src/Data/Either/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Either/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Either.Compat" -- from a globally unique namespace. module Data.Either.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Foldable/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Foldable/Compat/Repl/Batteries.hs index 43d0fc7..2cf3592 100644 --- a/base-compat-batteries/src/Data/Foldable/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Foldable/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Foldable.Compat" -- from a globally unique namespace. module Data.Foldable.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs index ee2a2d0..6150deb 100644 --- a/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Foldable1/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Foldable1.Compat" -- from a globally unique namespace. module Data.Foldable1.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Function/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Function/Compat/Repl/Batteries.hs index 70d1f9f..060c300 100644 --- a/base-compat-batteries/src/Data/Function/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Function/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Function.Compat" -- from a globally unique namespace. module Data.Function.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Compat/Repl/Batteries.hs index 7734a75..dd8dfb5 100644 --- a/base-compat-batteries/src/Data/Functor/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Compat" -- from a globally unique namespace. module Data.Functor.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Compose/Compat.hs b/base-compat-batteries/src/Data/Functor/Compose/Compat.hs index 876bbfb..ecdaa1a 100644 --- a/base-compat-batteries/src/Data/Functor/Compose/Compat.hs +++ b/base-compat-batteries/src/Data/Functor/Compose/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Functor.Compose.Compat ( module Base ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Data.Functor.Compose.Compat as Base -#else -import Data.Functor.Compose as Base -#endif diff --git a/base-compat-batteries/src/Data/Functor/Compose/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Compose/Compat/Repl/Batteries.hs index 6848dc5..2574ae9 100644 --- a/base-compat-batteries/src/Data/Functor/Compose/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Compose/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Compose.Compat" -- from a globally unique namespace. module Data.Functor.Compose.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Const/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Const/Compat/Repl/Batteries.hs index b006328..9df0b72 100644 --- a/base-compat-batteries/src/Data/Functor/Const/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Const/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Const.Compat" -- from a globally unique namespace. module Data.Functor.Const.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Contravariant/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Contravariant/Compat/Repl/Batteries.hs index ad5cc2d..e3a02bc 100644 --- a/base-compat-batteries/src/Data/Functor/Contravariant/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Contravariant/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Contravariant.Compat" -- from a globally unique namespace. module Data.Functor.Contravariant.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Identity/Compat.hs b/base-compat-batteries/src/Data/Functor/Identity/Compat.hs index 41c4ef7..ac3e9a0 100644 --- a/base-compat-batteries/src/Data/Functor/Identity/Compat.hs +++ b/base-compat-batteries/src/Data/Functor/Identity/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Functor.Identity.Compat ( module Base ) where -#if MIN_VERSION_base(4,8,0) import "base-compat" Data.Functor.Identity.Compat as Base -#else -import Data.Functor.Identity as Base -#endif diff --git a/base-compat-batteries/src/Data/Functor/Identity/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Identity/Compat/Repl/Batteries.hs index 29655f2..571be04 100644 --- a/base-compat-batteries/src/Data/Functor/Identity/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Identity/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Identity.Compat" -- from a globally unique namespace. module Data.Functor.Identity.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Product/Compat.hs b/base-compat-batteries/src/Data/Functor/Product/Compat.hs index 6c3969c..77c35d0 100644 --- a/base-compat-batteries/src/Data/Functor/Product/Compat.hs +++ b/base-compat-batteries/src/Data/Functor/Product/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Functor.Product.Compat ( module Base ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Data.Functor.Product.Compat as Base -#else -import Data.Functor.Product as Base -#endif diff --git a/base-compat-batteries/src/Data/Functor/Product/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Product/Compat/Repl/Batteries.hs index 8ade76e..a1c1967 100644 --- a/base-compat-batteries/src/Data/Functor/Product/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Product/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Product.Compat" -- from a globally unique namespace. module Data.Functor.Product.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Functor/Sum/Compat.hs b/base-compat-batteries/src/Data/Functor/Sum/Compat.hs index d8fbd6e..558d02c 100644 --- a/base-compat-batteries/src/Data/Functor/Sum/Compat.hs +++ b/base-compat-batteries/src/Data/Functor/Sum/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Functor.Sum.Compat ( module Base ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Data.Functor.Sum.Compat as Base -#else -import Data.Functor.Sum as Base -#endif diff --git a/base-compat-batteries/src/Data/Functor/Sum/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Functor/Sum/Compat/Repl/Batteries.hs index 96069f8..8ee88a8 100644 --- a/base-compat-batteries/src/Data/Functor/Sum/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Functor/Sum/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Sum.Compat" -- from a globally unique namespace. module Data.Functor.Sum.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/IORef/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/IORef/Compat/Repl/Batteries.hs index 8990d3e..eb43b7e 100644 --- a/base-compat-batteries/src/Data/IORef/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/IORef/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.IORef.Compat" -- from a globally unique namespace. module Data.IORef.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/List/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/List/Compat/Repl/Batteries.hs index d17d682..1d6140a 100644 --- a/base-compat-batteries/src/Data/List/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/List/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.List.Compat" -- from a globally unique namespace. module Data.List.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/List/NonEmpty/Compat.hs b/base-compat-batteries/src/Data/List/NonEmpty/Compat.hs index 6345674..57d81b3 100644 --- a/base-compat-batteries/src/Data/List/NonEmpty/Compat.hs +++ b/base-compat-batteries/src/Data/List/NonEmpty/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.List.NonEmpty.Compat ( -- * The type of non-empty streams NonEmpty(..) @@ -78,156 +78,4 @@ module Data.List.NonEmpty.Compat ( , xor ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Data.List.NonEmpty.Compat -#else -import "semigroups" Data.List.NonEmpty - -import qualified "this" Prelude.Compat as Prelude -import "this" Prelude.Compat ((.)) - -import qualified "this" Data.Foldable.Compat as Foldable -import qualified "this" Data.List.Compat as List -#endif - -#if !(MIN_VERSION_base(4,9,0)) --- | A monomorphic version of 'Prelude.<>' for 'NonEmpty'. --- --- >>> append (1 :| []) (2 :| [3]) --- 1 :| [2,3] --- --- /Since: 4.16/ -append :: NonEmpty a -> NonEmpty a -> NonEmpty a -append = (Prelude.<>) - --- | Attach a list at the end of a 'NonEmpty'. --- --- >>> appendList (1 :| [2,3]) [] --- 1 :| [2,3] --- --- >>> appendList (1 :| [2,3]) [4,5] --- 1 :| [2,3,4,5] --- --- /Since: 4.16/ -appendList :: NonEmpty a -> [a] -> NonEmpty a -appendList (x :| xs) ys = x :| xs Prelude.<> ys - --- | Attach a list at the beginning of a 'NonEmpty'. --- --- >>> prependList [] (1 :| [2,3]) --- 1 :| [2,3] --- --- >>> prependList [negate 1, 0] (1 :| [2, 3]) --- -1 :| [0,1,2,3] --- --- /Since: 4.16/ -prependList :: [a] -> NonEmpty a -> NonEmpty a -prependList ls ne = case ls of - [] -> ne - (x : xs) -> x :| xs Prelude.<> toList ne --- | Construct a 'NonEmpty' list from a single element. --- --- /Since: 4.15/ -singleton :: a -> NonEmpty a -singleton a = a :| [] - --- | 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 - --- | The 'permutations' function returns the list of all permutations of the argument. --- --- /Since: 4.20.0.0/ -permutations :: [a] -> NonEmpty [a] -permutations xs0 = xs0 :| perms xs0 [] - where - perms [] _ = [] - perms (t:ts) is = List.foldr interleave (perms ts (t:is)) (permutations is) - where interleave xs r = let (_,zs) = interleave' Prelude.id xs r in zs - interleave' _ [] r = (ts, r) - interleave' f (y:ys) r = let (us,zs) = interleave' (f . (y:)) ys r - in (y:us, f (t:y:us) : zs) --- The implementation of 'permutations' is adopted from 'GHC.Internal.Data.List.permutations', --- see there for discussion and explanations. - --- | 'permutations1' operates like 'permutations', but uses the knowledge that its input is --- non-empty to produce output where every element is non-empty. --- --- > permutations1 = fmap fromList . permutations . toList --- --- /Since: 4.20.0.0/ -permutations1 :: NonEmpty a -> NonEmpty (NonEmpty a) -permutations1 xs = fromList Prelude.<$> permutations (toList xs) - --- | Sort a 'NonEmpty' on a user-supplied projection of its elements. --- See 'List.sortOn' for more detailed information. --- --- ==== __Examples__ --- --- >>> sortOn fst $ (2, "world") :| [(4, "!"), (1, "Hello")] --- (1,"Hello") :| [(2,"world"),(4,"!")] --- --- >>> sortOn length $ "jim" :| ["creed", "pam", "michael", "dwight", "kevin"] --- "jim" :| ["pam","creed","kevin","dwight","michael"] --- --- ==== __Performance notes__ --- --- This function minimises the projections performed, by materialising --- the projections in an intermediate list. --- --- For trivial projections, you should prefer using 'sortBy' with --- 'comparing', for example: --- --- >>> sortBy (comparing fst) $ (3, 1) :| [(2, 2), (1, 3)] --- (1,3) :| [(2,2),(3,1)] --- --- Or, for the exact same API as 'sortOn', you can use `sortBy . comparing`: --- --- >>> (sortBy . comparing) fst $ (3, 1) :| [(2, 2), (1, 3)] --- (1,3) :| [(2,2),(3,1)] --- --- 'sortWith' is an alias for `sortBy . comparing`. --- --- /Since: 4.20.0.0/ -sortOn :: Prelude.Ord b => (a -> b) -> NonEmpty a -> NonEmpty a -sortOn f = lift (List.sortOn f) - --- | Lift list operations to work on a 'NonEmpty' stream. --- --- /Beware/: If the provided function returns an empty list, --- this will raise an error. -lift :: Foldable.Foldable f => ([a] -> [b]) -> f a -> NonEmpty b -lift f = fromList . f . Foldable.toList -#endif diff --git a/base-compat-batteries/src/Data/List/NonEmpty/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/List/NonEmpty/Compat/Repl/Batteries.hs index 00574df..14d31cf 100644 --- a/base-compat-batteries/src/Data/List/NonEmpty/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/List/NonEmpty/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.List.NonEmpty.Compat" -- from a globally unique namespace. module Data.List.NonEmpty.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Monoid/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Monoid/Compat/Repl/Batteries.hs index 1b098f9..9906594 100644 --- a/base-compat-batteries/src/Data/Monoid/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Monoid/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Monoid.Compat" -- from a globally unique namespace. module Data.Monoid.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Proxy/Compat.hs b/base-compat-batteries/src/Data/Proxy/Compat.hs index 81f5cd9..fda12d8 100644 --- a/base-compat-batteries/src/Data/Proxy/Compat.hs +++ b/base-compat-batteries/src/Data/Proxy/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Proxy.Compat ( module Base ) where -#if MIN_VERSION_base(4,7,0) import "base-compat" Data.Proxy.Compat as Base -#else -import "tagged" Data.Proxy as Base -#endif diff --git a/base-compat-batteries/src/Data/Proxy/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Proxy/Compat/Repl/Batteries.hs index f4ff51b..7224b08 100644 --- a/base-compat-batteries/src/Data/Proxy/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Proxy/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Proxy.Compat" -- from a globally unique namespace. module Data.Proxy.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Ratio/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Ratio/Compat/Repl/Batteries.hs index 52e0d10..5d9c528 100644 --- a/base-compat-batteries/src/Data/Ratio/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Ratio/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Ratio.Compat" -- from a globally unique namespace. module Data.Ratio.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/STRef/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/STRef/Compat/Repl/Batteries.hs index 903ea96..3a2d501 100644 --- a/base-compat-batteries/src/Data/STRef/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/STRef/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.STRef.Compat" -- from a globally unique namespace. module Data.STRef.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Semigroup/Compat.hs b/base-compat-batteries/src/Data/Semigroup/Compat.hs index 45345b8..abfd6d7 100644 --- a/base-compat-batteries/src/Data/Semigroup/Compat.hs +++ b/base-compat-batteries/src/Data/Semigroup/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Semigroup.Compat ( Semigroup(..) , stimesMonoid @@ -27,8 +27,4 @@ module Data.Semigroup.Compat ( , ArgMax ) where -#if MIN_VERSION_base(4,9,0) import "base-compat" Data.Semigroup.Compat -#else -import "semigroups" Data.Semigroup -#endif diff --git a/base-compat-batteries/src/Data/Semigroup/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Semigroup/Compat/Repl/Batteries.hs index 26316ba..f41e4ef 100644 --- a/base-compat-batteries/src/Data/Semigroup/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Semigroup/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Semigroup.Compat" -- from a globally unique namespace. module Data.Semigroup.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/String/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/String/Compat/Repl/Batteries.hs index 2c1c063..f022130 100644 --- a/base-compat-batteries/src/Data/String/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/String/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.String.Compat" -- from a globally unique namespace. module Data.String.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Traversable/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Traversable/Compat/Repl/Batteries.hs index dd9a9d8..1a496a2 100644 --- a/base-compat-batteries/src/Data/Traversable/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Traversable/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Traversable.Compat" -- from a globally unique namespace. module Data.Traversable.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Tuple/Compat.hs b/base-compat-batteries/src/Data/Tuple/Compat.hs index c97fb7e..52a0848 100644 --- a/base-compat-batteries/src/Data/Tuple/Compat.hs +++ b/base-compat-batteries/src/Data/Tuple/Compat.hs @@ -1,12 +1,7 @@ {-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE PatternSynonyms #-} -#endif -- | This uses the @OneTuple@ compatibility library to backport 'Solo' to old --- versions of GHC. Note that @OneTuple@ makes use of pattern synonyms, which --- cannot be defined on pre-7.8 versions of GHC. As such, it is not feasible --- to backport the @Solo@ data constructor on pre-7.8 versions of GHC, as --- @OneTuple@ defines this as a pattern synonym. +-- versions of GHC. module Data.Tuple.Compat ( #if MIN_VERSION_ghc_prim(0,10,0) @@ -14,13 +9,8 @@ module Data.Tuple.Compat #elif MIN_VERSION_ghc_prim(0,7,0) Solo(Solo) , pattern MkSolo -#elif __GLASGOW_HASKELL__ >= 800 - Solo(MkSolo, Solo) -#elif __GLASGOW_HASKELL__ >= 708 - Solo(MkSolo) - , pattern Solo #else - Solo(MkSolo) + Solo(MkSolo, Solo) #endif , getSolo , fst diff --git a/base-compat-batteries/src/Data/Tuple/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Tuple/Compat/Repl/Batteries.hs index 62ea31f..966e142 100644 --- a/base-compat-batteries/src/Data/Tuple/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Tuple/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Tuple.Compat" -- from a globally unique namespace. module Data.Tuple.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Type/Coercion/Compat.hs b/base-compat-batteries/src/Data/Type/Coercion/Compat.hs index 685d1f2..d2dee6c 100644 --- a/base-compat-batteries/src/Data/Type/Coercion/Compat.hs +++ b/base-compat-batteries/src/Data/Type/Coercion/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Type.Coercion.Compat ( -#if MIN_VERSION_base(4,7,0) module Base -#endif ) where -#if MIN_VERSION_base(4,7,0) import "base-compat" Data.Type.Coercion.Compat as Base -#endif diff --git a/base-compat-batteries/src/Data/Type/Coercion/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Type/Coercion/Compat/Repl/Batteries.hs index 4c5e0df..7f5899e 100644 --- a/base-compat-batteries/src/Data/Type/Coercion/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Type/Coercion/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Type.Coercion.Compat" -- from a globally unique namespace. module Data.Type.Coercion.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Type/Equality/Compat.hs b/base-compat-batteries/src/Data/Type/Equality/Compat.hs index 810eae4..16d0cd6 100644 --- a/base-compat-batteries/src/Data/Type/Equality/Compat.hs +++ b/base-compat-batteries/src/Data/Type/Equality/Compat.hs @@ -1,45 +1,27 @@ {-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE ExplicitNamespaces #-} -#endif module Data.Type.Equality.Compat ( -- * The equality types (:~:)(..), -#if __GLASGOW_HASKELL__ >= 800 type (~~), -#endif -#if __GLASGOW_HASKELL__ >= 800 (:~~:)(..), -#endif -- * Working with equality sym, trans, castWith, gcastWith, -#if __GLASGOW_HASKELL__ >= 706 - apply, -#endif - inner, -#if __GLASGOW_HASKELL__ >= 706 - outer, -#endif + apply, + inner, + outer, -- * Inferring equality from other types TestEquality(..), -#if __GLASGOW_HASKELL__ >= 708 -- * Boolean type-level equality type (==), -#endif ) where -#if MIN_VERSION_base(4,7,0) import "base" Data.Type.Equality -#else -import "type-equality" Data.Type.Equality -#endif -#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,10,0) +#if !MIN_VERSION_base(4,10,0) import "type-equality" Data.Type.Equality.Hetero #endif diff --git a/base-compat-batteries/src/Data/Type/Equality/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Type/Equality/Compat/Repl/Batteries.hs index 1f47e5f..e17f5ab 100644 --- a/base-compat-batteries/src/Data/Type/Equality/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Type/Equality/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Type.Equality.Compat" -- from a globally unique namespace. module Data.Type.Equality.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Typeable/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Typeable/Compat/Repl/Batteries.hs index 198614c..3f735fc 100644 --- a/base-compat-batteries/src/Data/Typeable/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Typeable/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Typeable.Compat" -- from a globally unique namespace. module Data.Typeable.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Version/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Version/Compat/Repl/Batteries.hs index 30bc19a..5c884c9 100644 --- a/base-compat-batteries/src/Data/Version/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Version/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Version.Compat" -- from a globally unique namespace. module Data.Version.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Void/Compat.hs b/base-compat-batteries/src/Data/Void/Compat.hs index c305144..755aa05 100644 --- a/base-compat-batteries/src/Data/Void/Compat.hs +++ b/base-compat-batteries/src/Data/Void/Compat.hs @@ -1,12 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Data.Void.Compat ( Void , absurd , vacuous ) where -#if MIN_VERSION_base(4,8,0) import "base-compat" Data.Void.Compat as Base -#else -import "void" Data.Void as Base -#endif diff --git a/base-compat-batteries/src/Data/Void/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Void/Compat/Repl/Batteries.hs index 1d462f5..b52c19a 100644 --- a/base-compat-batteries/src/Data/Void/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Void/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Void.Compat" -- from a globally unique namespace. module Data.Void.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Data/Word/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Data/Word/Compat/Repl/Batteries.hs index 5a1f5e1..5edc861 100644 --- a/base-compat-batteries/src/Data/Word/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Data/Word/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Word.Compat" -- from a globally unique namespace. module Data.Word.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Debug/Trace/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Debug/Trace/Compat/Repl/Batteries.hs index 7305250..4b98472 100644 --- a/base-compat-batteries/src/Debug/Trace/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Debug/Trace/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Debug.Trace.Compat" -- from a globally unique namespace. module Debug.Trace.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Compat/Repl/Batteries.hs index ee5edc9..c6f6ea0 100644 --- a/base-compat-batteries/src/Foreign/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Compat" -- from a globally unique namespace. module Foreign.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/ForeignPtr/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/ForeignPtr/Compat/Repl/Batteries.hs index 190d919..06fc1a8 100644 --- a/base-compat-batteries/src/Foreign/ForeignPtr/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/ForeignPtr/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/ForeignPtr/Safe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/ForeignPtr/Safe/Compat/Repl/Batteries.hs index a4975ae..1ead7b8 100644 --- a/base-compat-batteries/src/Foreign/ForeignPtr/Safe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/ForeignPtr/Safe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Safe.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Safe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/ForeignPtr/Unsafe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/ForeignPtr/Unsafe/Compat/Repl/Batteries.hs index 3b3fbed..33f6066 100644 --- a/base-compat-batteries/src/Foreign/ForeignPtr/Unsafe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/ForeignPtr/Unsafe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Unsafe.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Unsafe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Alloc/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Alloc/Compat/Repl/Batteries.hs index 284708e..8b63f8f 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Alloc/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Alloc/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Alloc.Compat" -- from a globally unique namespace. module Foreign.Marshal.Alloc.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Array/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Array/Compat/Repl/Batteries.hs index 2ff8f5a..4a22d30 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Array/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Array/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Array.Compat" -- from a globally unique namespace. module Foreign.Marshal.Array.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Compat/Repl/Batteries.hs index bbec1a4..bafd7d9 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Compat" -- from a globally unique namespace. module Foreign.Marshal.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Safe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Safe/Compat/Repl/Batteries.hs index 73e9b96..4ec2baf 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Safe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Safe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Safe.Compat" -- from a globally unique namespace. module Foreign.Marshal.Safe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Unsafe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Unsafe/Compat/Repl/Batteries.hs index d5a3a06..4cf1a1c 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Unsafe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Unsafe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Unsafe.Compat" -- from a globally unique namespace. module Foreign.Marshal.Unsafe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Foreign/Marshal/Utils/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Foreign/Marshal/Utils/Compat/Repl/Batteries.hs index b18a09e..ad0301a 100644 --- a/base-compat-batteries/src/Foreign/Marshal/Utils/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Foreign/Marshal/Utils/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Utils.Compat" -- from a globally unique namespace. module Foreign.Marshal.Utils.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Numeric/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Numeric/Compat/Repl/Batteries.hs index 9405a43..06e4c0a 100644 --- a/base-compat-batteries/src/Numeric/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Numeric/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Numeric.Compat" -- from a globally unique namespace. module Numeric.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Numeric/Natural/Compat.hs b/base-compat-batteries/src/Numeric/Natural/Compat.hs index 313d154..079cf55 100644 --- a/base-compat-batteries/src/Numeric/Natural/Compat.hs +++ b/base-compat-batteries/src/Numeric/Natural/Compat.hs @@ -1,24 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} -#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} {-# LANGUAGE Trustworthy #-} -#endif module Numeric.Natural.Compat ( module Base , minusNaturalMaybe ) where -#if MIN_VERSION_base(4,8,0) import "base-compat" Numeric.Natural.Compat as Base -#else -import "nats" Numeric.Natural as Base - -import "this" Prelude.Compat - --- | 'Natural' subtraction. Returns 'Nothing's for non-positive results. --- --- /Since: 4.18.0.0/ -minusNaturalMaybe :: Natural -> Natural -> Maybe Natural -minusNaturalMaybe x y - | x < y = Nothing - | otherwise = Just (x - y) -#endif diff --git a/base-compat-batteries/src/Numeric/Natural/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Numeric/Natural/Compat/Repl/Batteries.hs index 06bd5f3..cf2b269 100644 --- a/base-compat-batteries/src/Numeric/Natural/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Numeric/Natural/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Numeric.Natural.Compat" -- from a globally unique namespace. module Numeric.Natural.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Prelude/Compat.hs b/base-compat-batteries/src/Prelude/Compat.hs index 0c5034f..c225586 100644 --- a/base-compat-batteries/src/Prelude/Compat.hs +++ b/base-compat-batteries/src/Prelude/Compat.hs @@ -1,18 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} +{-# LANGUAGE NoImplicitPrelude, PackageImports #-} module Prelude.Compat ( module Base -#if !(MIN_VERSION_base(4,9,0)) -, Fail.MonadFail(Fail.fail) -, Semi.Semigroup((Semi.<>)) -#endif ) where import "base-compat" Prelude.Compat as Base -#if !(MIN_VERSION_base(4,9,0)) - hiding (fail) -#endif - -#if !(MIN_VERSION_base(4,9,0)) -import "fail" Control.Monad.Fail as Fail -import "semigroups" Data.Semigroup as Semi -#endif diff --git a/base-compat-batteries/src/Prelude/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Prelude/Compat/Repl/Batteries.hs index 3ea7d7e..1a6f1a7 100644 --- a/base-compat-batteries/src/Prelude/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Prelude/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Prelude.Compat" -- from a globally unique namespace. module Prelude.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/System/Environment/Compat/Repl/Batteries.hs b/base-compat-batteries/src/System/Environment/Compat/Repl/Batteries.hs index fd25932..441315c 100644 --- a/base-compat-batteries/src/System/Environment/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/System/Environment/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.Environment.Compat" -- from a globally unique namespace. module System.Environment.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/System/Exit/Compat/Repl/Batteries.hs b/base-compat-batteries/src/System/Exit/Compat/Repl/Batteries.hs index ab73217..46f43b2 100644 --- a/base-compat-batteries/src/System/Exit/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/System/Exit/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.Exit.Compat" -- from a globally unique namespace. module System.Exit.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/System/IO/Compat/Repl/Batteries.hs b/base-compat-batteries/src/System/IO/Compat/Repl/Batteries.hs index 59ea46a..f1de84f 100644 --- a/base-compat-batteries/src/System/IO/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/System/IO/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Compat" -- from a globally unique namespace. module System.IO.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/System/IO/Error/Compat/Repl/Batteries.hs b/base-compat-batteries/src/System/IO/Error/Compat/Repl/Batteries.hs index 02c19cb..ca177ec 100644 --- a/base-compat-batteries/src/System/IO/Error/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/System/IO/Error/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Error.Compat" -- from a globally unique namespace. module System.IO.Error.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/System/IO/Unsafe/Compat/Repl/Batteries.hs b/base-compat-batteries/src/System/IO/Unsafe/Compat/Repl/Batteries.hs index 40015b1..ada308c 100644 --- a/base-compat-batteries/src/System/IO/Unsafe/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/System/IO/Unsafe/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Unsafe.Compat" -- from a globally unique namespace. module System.IO.Unsafe.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Text/Read/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Text/Read/Compat/Repl/Batteries.hs index 4fa4b7f..6373f17 100644 --- a/base-compat-batteries/src/Text/Read/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Text/Read/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Text.Read.Compat" -- from a globally unique namespace. module Text.Read.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Text/Read/Lex/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Text/Read/Lex/Compat/Repl/Batteries.hs index 0471dfb..0b0ccb4 100644 --- a/base-compat-batteries/src/Text/Read/Lex/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Text/Read/Lex/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Text.Read.Lex.Compat" -- from a globally unique namespace. module Text.Read.Lex.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/src/Type/Reflection/Compat/Repl/Batteries.hs b/base-compat-batteries/src/Type/Reflection/Compat/Repl/Batteries.hs index c77a133..c92cdec 100644 --- a/base-compat-batteries/src/Type/Reflection/Compat/Repl/Batteries.hs +++ b/base-compat-batteries/src/Type/Reflection/Compat/Repl/Batteries.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Type.Reflection.Compat" -- from a globally unique namespace. module Type.Reflection.Compat.Repl.Batteries ( diff --git a/base-compat-batteries/test/Data/Bits/CompatSpec.hs b/base-compat-batteries/test/Data/Bits/CompatSpec.hs index 17748f1..0c5bca7 100644 --- a/base-compat-batteries/test/Data/Bits/CompatSpec.hs +++ b/base-compat-batteries/test/Data/Bits/CompatSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} module Data.Bits.CompatSpec (main, spec) where import Test.Hspec @@ -26,9 +25,7 @@ spec = do popCountDefault (0 :: Int) `shouldBe` 0 popCountDefault (1 :: Int) `shouldBe` 1 popCountDefault (10 :: Int) `shouldBe` 2 -#if MIN_VERSION_base(4,7,0) describe "toIntegralSized" $ it "converts an Integral type to another as measured by bitSizeMaybe" $ do toIntegralSized (42 :: Integer) `shouldBe` (Just 42 :: Maybe Int) toIntegralSized (12345678901234567890 :: Integer) `shouldBe` (Nothing :: Maybe Int) -#endif diff --git a/base-compat-batteries/test/SafeHaskellSpec.hs b/base-compat-batteries/test/SafeHaskellSpec.hs index 3113940..22af329 100644 --- a/base-compat-batteries/test/SafeHaskellSpec.hs +++ b/base-compat-batteries/test/SafeHaskellSpec.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 704 +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE Safe #-} -#endif module SafeHaskellSpec (main, spec) where import TestHspecTrustworthy diff --git a/base-compat-batteries/test/System/Environment/CompatSpec.hs b/base-compat-batteries/test/System/Environment/CompatSpec.hs index 4c69379..9a21895 100644 --- a/base-compat-batteries/test/System/Environment/CompatSpec.hs +++ b/base-compat-batteries/test/System/Environment/CompatSpec.hs @@ -1,10 +1,7 @@ -{-# LANGUAGE CPP #-} module System.Environment.CompatSpec (main, spec) where import Test.Hspec -#if __GLASGOW_HASKELL__ >= 704 import Test.QuickCheck -#endif import qualified Control.Exception as E import GHC.IO.Exception (IOErrorType (InvalidArgument)) @@ -56,13 +53,11 @@ spec = do it "throws an exception if key contains '='" $ do unsetEnv "some=key" `shouldThrow` (== InvalidArgument) . ioeGetErrorType -#if __GLASGOW_HASKELL__ >= 704 it "works for arbitrary keys" $ property $ \k -> ('\NUL' `notElem` k && '=' `notElem` k && (not . null) k) ==> do setEnv k "foo" unsetEnv k getEnv k `shouldThrow` isDoesNotExistError -#endif describe "setEnv" $ do it "sets specified environment variable to given value" $ do @@ -96,7 +91,6 @@ spec = do setEnv "FOO\NULBAR" "foo" getEnv "FOO" `shouldReturn` "foo" -#if __GLASGOW_HASKELL__ >= 704 it "works for unicode" $ do unsetEnv "FOO" setEnv "FOO" "foo-\955-bar" @@ -106,7 +100,6 @@ spec = do property $ \v -> ('\NUL' `notElem` v && (not . null) v) ==> do setEnv "FOO" v getEnv "FOO" `shouldReturn` v -#endif it "works for unicode keys" $ do setEnv "foo-\955-bar" "foo" @@ -118,9 +111,7 @@ spec = do it "throws an exception if key contains '='" $ do setEnv "some=key" "foo" `shouldThrow` (== InvalidArgument) . ioeGetErrorType -#if __GLASGOW_HASKELL__ >= 704 it "works for arbitrary keys" $ property $ \k -> ('\NUL' `notElem` k && '=' `notElem` k && (not . null) k) ==> do setEnv k "foo" getEnv k `shouldReturn` "foo" -#endif diff --git a/base-compat-batteries/test/TestHspecTrustworthy.hs b/base-compat-batteries/test/TestHspecTrustworthy.hs index 6f03f01..6f3b598 100644 --- a/base-compat-batteries/test/TestHspecTrustworthy.hs +++ b/base-compat-batteries/test/TestHspecTrustworthy.hs @@ -1,7 +1,4 @@ -{-# LANGUAGE CPP #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif -- | Reexports "Test.Hspec" from a @Trustworthy@ module. module TestHspecTrustworthy (module Test.Hspec) where diff --git a/base-compat/CHANGES.markdown b/base-compat/CHANGES.markdown index 4e9120b..fd0b442 100644 --- a/base-compat/CHANGES.markdown +++ b/base-compat/CHANGES.markdown @@ -1,3 +1,6 @@ +## Changes in next [????.??.??] + - Drop support for pre-8.0 versions of GHC. + ## Changes in 0.14.0 [2024.04.30] - Sync with `base-4.20`/GHC 9.10 - Backport `foldl'` to `Prelude.Compat` diff --git a/base-compat/README.markdown b/base-compat/README.markdown index e844398..2829c10 100644 --- a/base-compat/README.markdown +++ b/base-compat/README.markdown @@ -275,58 +275,21 @@ Here is a list of compatibility libraries that `base-compat-batteries` depends on, paired with the things that each library backports: * [`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` - * The [`Bifoldable`](http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Bifoldable.html#t:Bifoldable) - and [`Bitraversable`](http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Bitraversable.html#t:Bitraversable) - type classes, introduced in `base-4.10.0.0` + for the + [`Bifoldable`](http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Bifoldable.html#t:Bifoldable) + and + [`Bitraversable`](http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Bitraversable.html#t:Bitraversable) + type classes, introduced in `base-4.10.0.0` * [`contravariant`](http://hackage.haskell.org/package/contravariant) for the [`Contravariant`](http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Functor-Contravariant.html#t:Contravariant) type class, introduced in `base-4.12.0.0`. -* [`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` * [`OneTuple`](http://hackage.haskell.org/package/OneTuple) for the [`Solo`](https://hackage.haskell.org/package/base-4.16.0.0/docs/Data-Tuple.html#t:Solo) data type, introduced in `ghc-prim-0.7.0` -* [`semigroups`](http://hackage.haskell.org/package/semigroups) - for the [`Semigroup`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Semigroup) - typeclass and the - [`NonEmpty`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-List-NonEmpty.html#t:NonEmpty), - [`Min`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Min), - [`Max`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Max), - [`First`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:First), - [`Last`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Last), - [`WrappedMonoid`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:WrappedMonoid), - [`Option`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Option), - and - [`Arg`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Arg) - data types, introduced in `base-4.9.0.0` -* [`tagged`](http://hackage.haskell.org/package/tagged) - for the [`Proxy`](http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-Proxy.html#t:Proxy) - data type, introduced in `base-4.7.0.0` -* [`transformers`](http://hackage.haskell.org/package/transformers) - for: - * The [`Identity`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Functor-Identity.html#t:Identity) - data type, introduced in `base-4.8.0.0` - * The [`MonadIO`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad-IO-Class.html#t:MonadIO) - type class; and the - [`Compose`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Compose.html#t:Compose), - [`Product`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Product.html#t:Product), - and - [`Sum`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Sum.html#t:Sum) - data types, introduced in `base-4.9.0.0` -* [`void`](http://hackage.haskell.org/package/void) - 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 @@ -360,12 +323,6 @@ with identifiers of the same names in their code. * `ghc-8.4.*` / `base-4.11.*` * `ghc-8.2.*` / `base-4.10.*` * `ghc-8.0.*` / `base-4.9.*` - * `ghc-7.10.*` / `base-4.8.*` - * `ghc-7.8.*` / `base-4.7.*` - * `ghc-7.6.*` / `base-4.6.*` - * `ghc-7.4.*` / `base-4.5.*` - * `ghc-7.2.*` / `base-4.4.*` - * `ghc-7.0.*` / `base-4.3.*` We also make an attempt to keep `base-compat` building with GHC HEAD, but due to its volatility, it may not work at any given point in time. If it doesn't, diff --git a/base-compat/base-compat.cabal b/base-compat/base-compat.cabal index 3a22c64..5e275cd 100644 --- a/base-compat/base-compat.cabal +++ b/base-compat/base-compat.cabal @@ -44,13 +44,7 @@ description: Provides functions available in later versions of @base@ to anything in @base-compat-batteries@, to allow for easier use in GHCi. extra-source-files: CHANGES.markdown, README.markdown -tested-with: GHC == 7.0.4 - , GHC == 7.2.2 - , GHC == 7.4.2 - , GHC == 7.6.3 - , GHC == 7.8.4 - , GHC == 7.10.3 - , GHC == 8.0.2 +tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 @@ -59,7 +53,7 @@ tested-with: GHC == 7.0.4 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 - , GHC == 9.6.5 + , GHC == 9.6.6 , GHC == 9.8.2 , GHC == 9.10.1 @@ -74,14 +68,12 @@ library default-language: Haskell2010 build-depends: - base >= 4.3 && < 5, + base >= 4.9 && < 5, ghc-prim if !os(windows) && !os(halvm) build-depends: unix ghc-options: - -fno-warn-duplicate-exports - if impl(ghc >= 7.10) - ghc-options: -fno-warn-trustworthy-safe + -Wno-duplicate-exports -Wno-trustworthy-safe hs-source-dirs: src diff --git a/base-compat/src/Control/Concurrent/Compat.hs b/base-compat/src/Control/Concurrent/Compat.hs index c338825..1bfa9ae 100644 --- a/base-compat/src/Control/Concurrent/Compat.hs +++ b/base-compat/src/Control/Concurrent/Compat.hs @@ -1,8 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RankNTypes #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Control.Concurrent.Compat ( module Base , forkFinally @@ -10,38 +8,3 @@ module Control.Concurrent.Compat ( ) where import Control.Concurrent as Base - -#if !(MIN_VERSION_base(4,6,0)) -import Control.Exception -#endif - -#if !(MIN_VERSION_base(4,9,0)) -import GHC.IO (unsafeUnmask) -import Prelude -#endif - -#if !(MIN_VERSION_base(4,6,0)) --- | fork a thread and call the supplied function when the thread is about --- to terminate, with an exception or a returned value. The function is --- called with asynchronous exceptions masked. --- --- > forkFinally action and_then = --- > mask $ \restore -> --- > forkIO $ try (restore action) >>= and_then --- --- This function is useful for informing the parent when a child --- terminates, for example. --- --- /Since: 4.6.0.0/ -forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId -forkFinally action and_then = - mask $ \restore -> - forkIO $ try (restore action) >>= and_then -#endif - -#if !(MIN_VERSION_base(4,9,0)) --- | Like 'forkIOWithUnmask', but the child thread is a bound thread, --- as with 'forkOS'. -forkOSWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId -forkOSWithUnmask io = forkOS (io unsafeUnmask) -#endif diff --git a/base-compat/src/Control/Concurrent/Compat/Repl.hs b/base-compat/src/Control/Concurrent/Compat/Repl.hs index 391f634..d18e86c 100644 --- a/base-compat/src/Control/Concurrent/Compat/Repl.hs +++ b/base-compat/src/Control/Concurrent/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Concurrent.Compat" -- from a globally unique namespace. module Control.Concurrent.Compat.Repl ( diff --git a/base-compat/src/Control/Concurrent/MVar/Compat.hs b/base-compat/src/Control/Concurrent/MVar/Compat.hs index aacdfc8..ef09675 100644 --- a/base-compat/src/Control/Concurrent/MVar/Compat.hs +++ b/base-compat/src/Control/Concurrent/MVar/Compat.hs @@ -1,28 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Concurrent.MVar.Compat ( module Base , withMVarMasked ) where import Control.Concurrent.MVar as Base - -#if !(MIN_VERSION_base(4,7,0)) -import Control.Exception (mask_, onException) -import Control.Monad (return) -import Data.Function (($)) -import System.IO (IO) - -{-| - Like 'withMVar', but the @IO@ action in the second argument is executed - with asynchronous exceptions masked. - - @since 4.7.0.0 --} -{-# INLINE withMVarMasked #-} -withMVarMasked :: MVar a -> (a -> IO b) -> IO b -withMVarMasked m io = - mask_ $ do - a <- takeMVar m - b <- io a `onException` putMVar m a - putMVar m a - return b -#endif diff --git a/base-compat/src/Control/Concurrent/MVar/Compat/Repl.hs b/base-compat/src/Control/Concurrent/MVar/Compat/Repl.hs index eb3ad54..5c687f5 100644 --- a/base-compat/src/Control/Concurrent/MVar/Compat/Repl.hs +++ b/base-compat/src/Control/Concurrent/MVar/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Concurrent.MVar.Compat" -- from a globally unique namespace. module Control.Concurrent.MVar.Compat.Repl ( diff --git a/base-compat/src/Control/Exception/Compat.hs b/base-compat/src/Control/Exception/Compat.hs index 9e70ba4..30cf075 100644 --- a/base-compat/src/Control/Exception/Compat.hs +++ b/base-compat/src/Control/Exception/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif #if MIN_VERSION_base(4,10,0) {-# LANGUAGE DataKinds #-} {-# LANGUAGE MagicHash #-} diff --git a/base-compat/src/Control/Exception/Compat/Repl.hs b/base-compat/src/Control/Exception/Compat/Repl.hs index 9ff636f..44b7039 100644 --- a/base-compat/src/Control/Exception/Compat/Repl.hs +++ b/base-compat/src/Control/Exception/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Exception.Compat" -- from a globally unique namespace. module Control.Exception.Compat.Repl ( diff --git a/base-compat/src/Control/Monad/Compat.hs b/base-compat/src/Control/Monad/Compat.hs index e6b25d1..8e14241 100644 --- a/base-compat/src/Control/Monad/Compat.hs +++ b/base-compat/src/Control/Monad/Compat.hs @@ -1,197 +1,11 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Monad.Compat ( module Base , Monad -#if MIN_VERSION_base(4,9,0) , MonadFail -#endif , fail , MonadPlus(..) -#if !(MIN_VERSION_base(4,8,0)) -, foldM -, foldM_ -, forM -, forM_ -, guard -, mapM -, mapM_ -, msum -, sequence -, sequence_ -, unless -, when - -, (<$!>) -#endif -#if !(MIN_VERSION_base(4,9,0)) -, forever -, filterM -, mapAndUnzipM -, zipWithM -, zipWithM_ -, replicateM -, replicateM_ -#endif ) where -#if MIN_VERSION_base(4,9,0) import Control.Monad as Base hiding (fail) import Control.Monad.Fail as Base -#else -import Control.Monad as Base hiding ( - forever - , filterM - , mapAndUnzipM - , zipWithM - , zipWithM_ - , replicateM - , replicateM_ -# if !(MIN_VERSION_base(4,8,0)) - , foldM - , foldM_ - , forM - , forM_ - , guard - , mapM - , mapM_ - , msum - , sequence - , sequence_ - , unless - , when -# endif - ) -import Control.Applicative -import Data.Foldable.Compat -import Data.Traversable -import Prelude.Compat -#endif - -#if !(MIN_VERSION_base(4,8,0)) --- | Conditional execution of 'Applicative' expressions. For example, --- --- > when debug (putStrLn "Debugging") --- --- will output the string @Debugging@ if the Boolean value @debug@ --- is 'True', and otherwise do nothing. -when :: (Applicative f) => Bool -> f () -> f () -{-# INLINEABLE when #-} -{-# SPECIALISE when :: Bool -> IO () -> IO () #-} -{-# SPECIALISE when :: Bool -> Maybe () -> Maybe () #-} -when p s = if p then s else pure () - --- | @'guard' b@ is @'pure' ()@ if @b@ is 'True', --- and 'empty' if @b@ is 'False'. -guard :: (Alternative f) => Bool -> f () -guard True = pure () -guard False = empty - --- | The reverse of 'when'. -unless :: (Applicative f) => Bool -> f () -> f () -{-# INLINEABLE unless #-} -{-# SPECIALISE unless :: Bool -> IO () -> IO () #-} -{-# SPECIALISE unless :: Bool -> Maybe () -> Maybe () #-} -unless p s = if p then pure () else s - -{- | The 'foldM' function is analogous to 'foldl', except that its result is -encapsulated in a monad. Note that 'foldM' works from left-to-right over -the list arguments. This could be an issue where @('>>')@ and the `folded -function' are not commutative. - - -> foldM f a1 [x1, x2, ..., xm] - -== - -> do -> a2 <- f a1 x1 -> a3 <- f a2 x2 -> ... -> f am xm - -If right-to-left evaluation is required, the input list should be reversed. - -Note: 'foldM' is the same as 'foldlM' --} - -foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b -{-# INLINEABLE foldM #-} -{-# SPECIALISE foldM :: (a -> b -> IO a) -> a -> [b] -> IO a #-} -{-# SPECIALISE foldM :: (a -> b -> Maybe a) -> a -> [b] -> Maybe a #-} -foldM = foldlM - --- | Like 'foldM', but discards the result. -foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () -{-# INLINEABLE foldM_ #-} -{-# SPECIALISE foldM_ :: (a -> b -> IO a) -> a -> [b] -> IO () #-} -{-# SPECIALISE foldM_ :: (a -> b -> Maybe a) -> a -> [b] -> Maybe () #-} -foldM_ f a xs = foldlM f a xs >> return () - -infixl 4 <$!> - --- | Strict version of 'Data.Functor.<$>'. --- --- /Since: 4.8.0.0/ -(<$!>) :: Monad m => (a -> b) -> m a -> m b -{-# INLINE (<$!>) #-} -f <$!> m = do - x <- m - let z = f x - z `seq` return z -#endif - -#if !(MIN_VERSION_base(4,9,0)) --- | @'forever' act@ repeats the action infinitely. -forever :: (Applicative f) => f a -> f b -{-# INLINE forever #-} -forever a = let a' = a *> a' in a' --- Use explicit sharing here, as it is prevents a space leak regardless of --- optimizations. - --- | This generalizes the list-based 'filter' function. -{-# INLINE filterM #-} -filterM :: (Applicative m) => (a -> m Bool) -> [a] -> m [a] -filterM p = foldr (\ x -> liftA2 (\ flg -> if flg then (x:) else id) (p x)) (pure []) - --- | The 'mapAndUnzipM' function maps its first argument over a list, returning --- the result as a pair of lists. This function is mainly used with complicated --- data structures or a state-transforming monad. -mapAndUnzipM :: (Applicative m) => (a -> m (b,c)) -> [a] -> m ([b], [c]) -{-# INLINE mapAndUnzipM #-} -mapAndUnzipM f xs = unzip <$> traverse f xs - --- | The 'zipWithM' function generalizes 'zipWith' to arbitrary applicative functors. -zipWithM :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m [c] -{-# INLINE zipWithM #-} -zipWithM f xs ys = sequenceA (zipWith f xs ys) - --- | 'zipWithM_' is the extension of 'zipWithM' which ignores the final result. -zipWithM_ :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m () -{-# INLINE zipWithM_ #-} -zipWithM_ f xs ys = sequenceA_ (zipWith f xs ys) - --- | @'replicateM' n act@ performs the action @n@ times, --- gathering the results. -replicateM :: (Applicative m) => Int -> m a -> m [a] -{-# INLINEABLE replicateM #-} -{-# SPECIALISE replicateM :: Int -> IO a -> IO [a] #-} -{-# SPECIALISE replicateM :: Int -> Maybe a -> Maybe [a] #-} -replicateM cnt0 f = - loop cnt0 - where - loop cnt - | cnt <= 0 = pure [] - | otherwise = liftA2 (:) f (loop (cnt - 1)) - --- | Like 'replicateM', but discards the result. -replicateM_ :: (Applicative m) => Int -> m a -> m () -{-# INLINEABLE replicateM_ #-} -{-# SPECIALISE replicateM_ :: Int -> IO a -> IO () #-} -{-# SPECIALISE replicateM_ :: Int -> Maybe a -> Maybe () #-} -replicateM_ cnt0 f = - loop cnt0 - where - loop cnt - | cnt <= 0 = pure () - | otherwise = f *> loop (cnt - 1) -#endif diff --git a/base-compat/src/Control/Monad/Compat/Repl.hs b/base-compat/src/Control/Monad/Compat/Repl.hs index eec8569..deb1b3c 100644 --- a/base-compat/src/Control/Monad/Compat/Repl.hs +++ b/base-compat/src/Control/Monad/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.Compat" -- from a globally unique namespace. module Control.Monad.Compat.Repl ( diff --git a/base-compat/src/Control/Monad/Fail/Compat.hs b/base-compat/src/Control/Monad/Fail/Compat.hs index ead00b6..c20ff05 100644 --- a/base-compat/src/Control/Monad/Fail/Compat.hs +++ b/base-compat/src/Control/Monad/Fail/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Monad.Fail.Compat ( -#if MIN_VERSION_base(4,9,0) module Base -#endif ) where -#if MIN_VERSION_base(4,9,0) import Control.Monad.Fail as Base -#endif diff --git a/base-compat/src/Control/Monad/Fail/Compat/Repl.hs b/base-compat/src/Control/Monad/Fail/Compat/Repl.hs index 797a356..031a39c 100644 --- a/base-compat/src/Control/Monad/Fail/Compat/Repl.hs +++ b/base-compat/src/Control/Monad/Fail/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.Fail.Compat" -- from a globally unique namespace. module Control.Monad.Fail.Compat.Repl ( diff --git a/base-compat/src/Control/Monad/IO/Class/Compat.hs b/base-compat/src/Control/Monad/IO/Class/Compat.hs index ab52e48..b7f7715 100644 --- a/base-compat/src/Control/Monad/IO/Class/Compat.hs +++ b/base-compat/src/Control/Monad/IO/Class/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Monad.IO.Class.Compat ( -#if MIN_VERSION_base(4,9,0) module Base -#endif ) where -#if MIN_VERSION_base(4,9,0) import Control.Monad.IO.Class as Base -#endif diff --git a/base-compat/src/Control/Monad/IO/Class/Compat/Repl.hs b/base-compat/src/Control/Monad/IO/Class/Compat/Repl.hs index 70ad072..061f552 100644 --- a/base-compat/src/Control/Monad/IO/Class/Compat/Repl.hs +++ b/base-compat/src/Control/Monad/IO/Class/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.IO.Class.Compat" -- from a globally unique namespace. module Control.Monad.IO.Class.Compat.Repl ( diff --git a/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs b/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs index 0b9c427..3d05fbc 100644 --- a/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs +++ b/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs @@ -1,12 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Monad.ST.Lazy.Unsafe.Compat ( -- * Unsafe operations unsafeInterleaveST , unsafeIOToST ) where -#if MIN_VERSION_base(4,6,0) import Control.Monad.ST.Lazy.Unsafe (unsafeInterleaveST, unsafeIOToST) -#else -import Control.Monad.ST.Lazy (unsafeInterleaveST, unsafeIOToST) -#endif diff --git a/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl.hs b/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl.hs index f9a66a8..28cd7c9 100644 --- a/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl.hs +++ b/base-compat/src/Control/Monad/ST/Lazy/Unsafe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.ST.Lazy.Unsafe.Compat" -- from a globally unique namespace. module Control.Monad.ST.Lazy.Unsafe.Compat.Repl ( diff --git a/base-compat/src/Control/Monad/ST/Unsafe/Compat.hs b/base-compat/src/Control/Monad/ST/Unsafe/Compat.hs index f026864..d0e9647 100644 --- a/base-compat/src/Control/Monad/ST/Unsafe/Compat.hs +++ b/base-compat/src/Control/Monad/ST/Unsafe/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Control.Monad.ST.Unsafe.Compat ( -- * Unsafe operations unsafeInterleaveST @@ -6,8 +6,4 @@ module Control.Monad.ST.Unsafe.Compat ( , unsafeSTToIO ) where -#if MIN_VERSION_base(4,6,0) import Control.Monad.ST.Unsafe (unsafeInterleaveST, unsafeIOToST, unsafeSTToIO) -#else -import Control.Monad.ST (unsafeInterleaveST, unsafeIOToST, unsafeSTToIO) -#endif diff --git a/base-compat/src/Control/Monad/ST/Unsafe/Compat/Repl.hs b/base-compat/src/Control/Monad/ST/Unsafe/Compat/Repl.hs index 7fe66fc..0a9100c 100644 --- a/base-compat/src/Control/Monad/ST/Unsafe/Compat/Repl.hs +++ b/base-compat/src/Control/Monad/ST/Unsafe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Control.Monad.ST.Unsafe.Compat" -- from a globally unique namespace. module Control.Monad.ST.Unsafe.Compat.Repl ( diff --git a/base-compat/src/Data/Bifoldable/Compat/Repl.hs b/base-compat/src/Data/Bifoldable/Compat/Repl.hs index d4afdac..c1c20cb 100644 --- a/base-compat/src/Data/Bifoldable/Compat/Repl.hs +++ b/base-compat/src/Data/Bifoldable/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifoldable.Compat" -- from a globally unique namespace. module Data.Bifoldable.Compat.Repl ( diff --git a/base-compat/src/Data/Bifoldable1/Compat/Repl.hs b/base-compat/src/Data/Bifoldable1/Compat/Repl.hs index 69b230a..29ce29b 100644 --- a/base-compat/src/Data/Bifoldable1/Compat/Repl.hs +++ b/base-compat/src/Data/Bifoldable1/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifoldable1.Compat" -- from a globally unique namespace. module Data.Bifoldable1.Compat.Repl ( diff --git a/base-compat/src/Data/Bifunctor/Compat.hs b/base-compat/src/Data/Bifunctor/Compat.hs index ff0e50d..e568433 100644 --- a/base-compat/src/Data/Bifunctor/Compat.hs +++ b/base-compat/src/Data/Bifunctor/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Bifunctor.Compat ( -#if MIN_VERSION_base(4,8,0) module Base -#endif ) where -#if MIN_VERSION_base(4,8,0) import Data.Bifunctor as Base -#endif diff --git a/base-compat/src/Data/Bifunctor/Compat/Repl.hs b/base-compat/src/Data/Bifunctor/Compat/Repl.hs index 1c702a7..7310177 100644 --- a/base-compat/src/Data/Bifunctor/Compat/Repl.hs +++ b/base-compat/src/Data/Bifunctor/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bifunctor.Compat" -- from a globally unique namespace. module Data.Bifunctor.Compat.Repl ( diff --git a/base-compat/src/Data/Bitraversable/Compat/Repl.hs b/base-compat/src/Data/Bitraversable/Compat/Repl.hs index f7449bc..562b754 100644 --- a/base-compat/src/Data/Bitraversable/Compat/Repl.hs +++ b/base-compat/src/Data/Bitraversable/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bitraversable.Compat" -- from a globally unique namespace. module Data.Bitraversable.Compat.Repl ( diff --git a/base-compat/src/Data/Bits/Compat.hs b/base-compat/src/Data/Bits/Compat.hs index f56635a..f94b6ce 100644 --- a/base-compat/src/Data/Bits/Compat.hs +++ b/base-compat/src/Data/Bits/Compat.hs @@ -8,14 +8,10 @@ module Data.Bits.Compat ( , (.^.) , (.>>.) , (.<<.) -#if MIN_VERSION_base(4,5,0) , (!>>.) , (!<<.) -#endif -#if MIN_VERSION_base(4,7,0) , toIntegralSized , oneBits -#endif ) where import Data.Bits as Base @@ -24,39 +20,6 @@ import Data.Bits as Base import Prelude #endif -#if !(MIN_VERSION_base(4,6,0)) --- | Default implementation for 'bit'. --- --- Note that: @bitDefault i = 1 `shiftL` i@ --- --- /Since: 4.6.0.0/ -bitDefault :: (Bits a, Num a) => Int -> a -bitDefault = \i -> 1 `shiftL` i -{-# INLINE bitDefault #-} - --- | Default implementation for 'testBit'. --- --- Note that: @testBitDefault x i = (x .&. bit i) /= 0@ --- --- /Since: 4.6.0.0/ -testBitDefault :: (Bits a, Num a) => a -> Int -> Bool -testBitDefault = \x i -> (x .&. bit i) /= 0 -{-# INLINE testBitDefault #-} - --- | Default implementation for 'popCount'. --- --- This implementation is intentionally naive. Instances are expected to provide --- an optimized implementation for their size. --- --- /Since: 4.6.0.0/ -popCountDefault :: (Bits a, Num a) => a -> Int -popCountDefault = go 0 - where - go !c 0 = c - go c w = go (c+1) (w .&. (w - 1)) -- clear the least significant -{-# INLINABLE popCountDefault #-} -#endif - #if !(MIN_VERSION_base(4,17,0)) -- | Infix version of 'xor'. -- @@ -82,7 +45,6 @@ infixl 8 .>>. infixl 8 .<<. -# if MIN_VERSION_base(4,5,0) -- | Infix version of 'unsafeShiftR'. -- -- /Since: 4.17/ @@ -98,87 +60,9 @@ infixl 8 !>>. (!<<.) = unsafeShiftL infixl 8 !<<. -# endif #endif -#if MIN_VERSION_base(4,7,0) -# if !(MIN_VERSION_base(4,8,0)) --- | Attempt to convert an 'Integral' type @a@ to an 'Integral' type @b@ using --- the size of the types as measured by 'Bits' methods. --- --- A simpler version of this function is: --- --- > toIntegral :: (Integral a, Integral b) => a -> Maybe b --- > toIntegral x --- > | toInteger x == y = Just (fromInteger y) --- > | otherwise = Nothing --- > where --- > y = toInteger x --- --- This version requires going through 'Integer', which can be inefficient. --- However, @toIntegralSized@ is optimized to allow GHC to statically determine --- the relative type sizes (as measured by 'bitSizeMaybe' and 'isSigned') and --- avoid going through 'Integer' for many types. (The implementation uses --- 'fromIntegral', which is itself optimized with rules for @base@ types but may --- go through 'Integer' for some type pairs.) --- --- /Since: 4.8.0.0/ - -toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b -toIntegralSized x -- See Note [toIntegralSized optimization] - | maybe True (<= x) yMinBound - , maybe True (x <=) yMaxBound = Just y - | otherwise = Nothing - where - y = fromIntegral x - - xWidth = bitSizeMaybe x - yWidth = bitSizeMaybe y - - yMinBound - | isBitSubType x y = Nothing - | isSigned x, not (isSigned y) = Just 0 - | isSigned x, isSigned y - , Just yW <- yWidth = Just (negate $ bit (yW-1)) -- Assumes sub-type - | otherwise = Nothing - - yMaxBound - | isBitSubType x y = Nothing - | isSigned x, not (isSigned y) - , Just xW <- xWidth, Just yW <- yWidth - , xW <= yW+1 = Nothing -- Max bound beyond a's domain - | Just yW <- yWidth = if isSigned y - then Just (bit (yW-1)-1) - else Just (bit yW-1) - | otherwise = Nothing -{-# INLINEABLE toIntegralSized #-} - --- | 'True' if the size of @a@ is @<=@ the size of @b@, where size is measured --- by 'bitSizeMaybe' and 'isSigned'. -isBitSubType :: (Bits a, Bits b) => a -> b -> Bool -isBitSubType x y - -- Reflexive - | xWidth == yWidth, xSigned == ySigned = True - - -- Every integer is a subset of 'Integer' - | ySigned, Nothing == yWidth = True - | not xSigned, not ySigned, Nothing == yWidth = True - - -- Sub-type relations between fixed-with types - | xSigned == ySigned, Just xW <- xWidth, Just yW <- yWidth = xW <= yW - | not xSigned, ySigned, Just xW <- xWidth, Just yW <- yWidth = xW < yW - - | otherwise = False - where - xWidth = bitSizeMaybe x - xSigned = isSigned x - - yWidth = bitSizeMaybe y - ySigned = isSigned y -{-# INLINE isBitSubType #-} -# endif - -# if !(MIN_VERSION_base(4,16,0)) +#if !(MIN_VERSION_base(4,16,0)) -- | A more concise version of @complement zeroBits@. -- -- >>> complement (zeroBits :: Word) == (oneBits :: Word) @@ -197,5 +81,4 @@ isBitSubType x y oneBits :: (FiniteBits a) => a oneBits = complement zeroBits {-# INLINE oneBits #-} -# endif #endif diff --git a/base-compat/src/Data/Bits/Compat/Repl.hs b/base-compat/src/Data/Bits/Compat/Repl.hs index aeee129..e0728ad 100644 --- a/base-compat/src/Data/Bits/Compat/Repl.hs +++ b/base-compat/src/Data/Bits/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bits.Compat" -- from a globally unique namespace. module Data.Bits.Compat.Repl ( diff --git a/base-compat/src/Data/Bool/Compat.hs b/base-compat/src/Data/Bool/Compat.hs index 5b5a248..b19baa9 100644 --- a/base-compat/src/Data/Bool/Compat.hs +++ b/base-compat/src/Data/Bool/Compat.hs @@ -1,18 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Bool.Compat ( module Base , bool ) where import Data.Bool as Base - -#if !(MIN_VERSION_base(4,7,0)) --- | Case analysis for the 'Bool' type. --- @bool a b p@ evaluates to @a@ when @p@ is @False@, and evaluates to @b@ --- when @p@ is @True@. --- --- /Since: 4.7.0.0/ -bool :: a -> a -> Bool -> a -bool f _ False = f -bool _ t True = t -#endif diff --git a/base-compat/src/Data/Bool/Compat/Repl.hs b/base-compat/src/Data/Bool/Compat/Repl.hs index c42c588..b1551c7 100644 --- a/base-compat/src/Data/Bool/Compat/Repl.hs +++ b/base-compat/src/Data/Bool/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Bool.Compat" -- from a globally unique namespace. module Data.Bool.Compat.Repl ( diff --git a/base-compat/src/Data/Complex/Compat.hs b/base-compat/src/Data/Complex/Compat.hs index 974001f..529c9ea 100644 --- a/base-compat/src/Data/Complex/Compat.hs +++ b/base-compat/src/Data/Complex/Compat.hs @@ -1,50 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Complex.Compat ( module Base -#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,8,0)) -, realPart -, imagPart -, mkPolar -, cis -, conjugate -#endif ) where -#if !(MIN_VERSION_base(4,4,0)) || MIN_VERSION_base(4,8,0) import Data.Complex as Base -#else -import Data.Complex as Base hiding ( - realPart - , imagPart - , mkPolar - , cis - , conjugate - ) -import Prelude -#endif - -#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,8,0)) --- | Extracts the real part of a complex number. -realPart :: Complex a -> a -realPart (x :+ _) = x - --- | Extracts the imaginary part of a complex number. -imagPart :: Complex a -> a -imagPart (_ :+ y) = y - --- | The conjugate of a complex number. -{-# SPECIALISE conjugate :: Complex Double -> Complex Double #-} -conjugate :: Num a => Complex a -> Complex a -conjugate (x:+y) = x :+ (-y) - --- | Form a complex number from polar components of magnitude and phase. -{-# SPECIALISE mkPolar :: Double -> Double -> Complex Double #-} -mkPolar :: Floating a => a -> a -> Complex a -mkPolar r theta = r * cos theta :+ r * sin theta - --- | @'cis' t@ is a complex value with magnitude @1@ --- and phase @t@ (modulo @2*'pi'@). -{-# SPECIALISE cis :: Double -> Complex Double #-} -cis :: Floating a => a -> Complex a -cis theta = cos theta :+ sin theta -#endif diff --git a/base-compat/src/Data/Complex/Compat/Repl.hs b/base-compat/src/Data/Complex/Compat/Repl.hs index f3e5737..e51196a 100644 --- a/base-compat/src/Data/Complex/Compat/Repl.hs +++ b/base-compat/src/Data/Complex/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Complex.Compat" -- from a globally unique namespace. module Data.Complex.Compat.Repl ( diff --git a/base-compat/src/Data/Either/Compat.hs b/base-compat/src/Data/Either/Compat.hs index 87829fe..ee47636 100644 --- a/base-compat/src/Data/Either/Compat.hs +++ b/base-compat/src/Data/Either/Compat.hs @@ -8,24 +8,6 @@ module Data.Either.Compat ( ) where import Data.Either as Base -#if !(MIN_VERSION_base(4,7,0)) -import Data.Bool (Bool(..)) - --- | Return `True` if the given value is a `Left`-value, `False` otherwise. --- --- /Since: 4.7.0.0/ -isLeft :: Either a b -> Bool -isLeft (Left _) = True -isLeft (Right _) = False - --- | Return `True` if the given value is a `Right`-value, `False` otherwise. --- --- /Since: 4.7.0.0/ -isRight :: Either a b -> Bool -isRight (Left _) = False -isRight (Right _) = True -#endif - #if !(MIN_VERSION_base(4,10,0)) -- | Return the contents of a 'Left'-value or a default value otherwise. -- diff --git a/base-compat/src/Data/Either/Compat/Repl.hs b/base-compat/src/Data/Either/Compat/Repl.hs index 8151f3f..2ca98bf 100644 --- a/base-compat/src/Data/Either/Compat/Repl.hs +++ b/base-compat/src/Data/Either/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Either.Compat" -- from a globally unique namespace. module Data.Either.Compat.Repl ( diff --git a/base-compat/src/Data/Foldable/Compat.hs b/base-compat/src/Data/Foldable/Compat.hs index 768d709..acda2ca 100644 --- a/base-compat/src/Data/Foldable/Compat.hs +++ b/base-compat/src/Data/Foldable/Compat.hs @@ -1,10 +1,6 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} module Data.Foldable.Compat ( module Base -#if !(MIN_VERSION_base(4,8,0)) -, length -, null -#endif #if !(MIN_VERSION_base(4,10,0)) , maximumBy , minimumBy @@ -18,22 +14,6 @@ import Data.Foldable as Base hiding (maximumBy, minimumBy) import Prelude (Ordering(..)) #endif -#if !(MIN_VERSION_base(4,8,0)) -import Prelude (Bool(..), Int, (+)) - --- | Test whether the structure is empty. The default implementation is --- optimized for structures that are similar to cons-lists, because there --- is no general way to do better. -null :: Foldable t => t a -> Bool -null = foldr (\_ _ -> False) True - --- | Returns the size/length of a finite structure as an 'Int'. The --- default implementation is optimized for structures that are similar to --- cons-lists, because there is no general way to do better. -length :: Foldable t => t a -> Int -length = foldl' (\c _ -> c+1) 0 -#endif - #if !(MIN_VERSION_base(4,10,0)) -- | The largest element of a non-empty structure with respect to the -- given comparison function. diff --git a/base-compat/src/Data/Foldable/Compat/Repl.hs b/base-compat/src/Data/Foldable/Compat/Repl.hs index f556bff..06e87de 100644 --- a/base-compat/src/Data/Foldable/Compat/Repl.hs +++ b/base-compat/src/Data/Foldable/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Foldable.Compat" -- from a globally unique namespace. module Data.Foldable.Compat.Repl ( diff --git a/base-compat/src/Data/Foldable1/Compat/Repl.hs b/base-compat/src/Data/Foldable1/Compat/Repl.hs index 21a4d79..767c994 100644 --- a/base-compat/src/Data/Foldable1/Compat/Repl.hs +++ b/base-compat/src/Data/Foldable1/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Foldable1.Compat" -- from a globally unique namespace. module Data.Foldable1.Compat.Repl ( diff --git a/base-compat/src/Data/Function/Compat.hs b/base-compat/src/Data/Function/Compat.hs index 4184fc3..4eac19d 100644 --- a/base-compat/src/Data/Function/Compat.hs +++ b/base-compat/src/Data/Function/Compat.hs @@ -10,19 +10,6 @@ import Data.Function as Base import Prelude.Compat #endif -#if !(MIN_VERSION_base(4,8,0)) -infixl 1 & - --- | '&' is a reverse application operator. This provides notational --- convenience. Its precedence is one higher than that of the forward --- application operator '$', which allows '&' to be nested in '$'. --- --- /Since: 4.8.0.0/ -(&) :: a -> (a -> b) -> b -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. diff --git a/base-compat/src/Data/Function/Compat/Repl.hs b/base-compat/src/Data/Function/Compat/Repl.hs index 701f603..c7f3347 100644 --- a/base-compat/src/Data/Function/Compat/Repl.hs +++ b/base-compat/src/Data/Function/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Function.Compat" -- from a globally unique namespace. module Data.Function.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Compat.hs b/base-compat/src/Data/Functor/Compat.hs index 18d6a5d..cceb862 100644 --- a/base-compat/src/Data/Functor/Compat.hs +++ b/base-compat/src/Data/Functor/Compat.hs @@ -9,25 +9,10 @@ module Data.Functor.Compat ( ) where import Data.Functor as Base -#if !(MIN_VERSION_base(4,7,0)) -import Control.Monad.Compat (void) -import Data.Function (flip) -#endif - #if !(MIN_VERSION_base(4,19,0)) import Data.Tuple (fst, snd) #endif -#if !(MIN_VERSION_base(4,7,0)) -infixl 4 $> - --- | Flipped version of '$>'. --- --- /Since: 4.7.0.0/ -($>) :: Functor f => f a -> b -> f b -($>) = flip (<$) -#endif - #if !(MIN_VERSION_base(4,11,0)) -- | Flipped version of '<$>'. -- diff --git a/base-compat/src/Data/Functor/Compat/Repl.hs b/base-compat/src/Data/Functor/Compat/Repl.hs index 4072881..83dea3a 100644 --- a/base-compat/src/Data/Functor/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Compat" -- from a globally unique namespace. module Data.Functor.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Compose/Compat.hs b/base-compat/src/Data/Functor/Compose/Compat.hs index d22caf8..7c1b95a 100644 --- a/base-compat/src/Data/Functor/Compose/Compat.hs +++ b/base-compat/src/Data/Functor/Compose/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Functor.Compose.Compat ( -#if MIN_VERSION_base(4,9,0) module Base -#endif ) where -#if MIN_VERSION_base(4,9,0) import Data.Functor.Compose as Base -#endif diff --git a/base-compat/src/Data/Functor/Compose/Compat/Repl.hs b/base-compat/src/Data/Functor/Compose/Compat/Repl.hs index a58ee49..e160157 100644 --- a/base-compat/src/Data/Functor/Compose/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Compose/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Compose.Compat" -- from a globally unique namespace. module Data.Functor.Compose.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Const/Compat/Repl.hs b/base-compat/src/Data/Functor/Const/Compat/Repl.hs index 2a2caa8..1090c71 100644 --- a/base-compat/src/Data/Functor/Const/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Const/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Const.Compat" -- from a globally unique namespace. module Data.Functor.Const.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Contravariant/Compat/Repl.hs b/base-compat/src/Data/Functor/Contravariant/Compat/Repl.hs index 26e3f26..d8f0c82 100644 --- a/base-compat/src/Data/Functor/Contravariant/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Contravariant/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Contravariant.Compat" -- from a globally unique namespace. module Data.Functor.Contravariant.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Identity/Compat.hs b/base-compat/src/Data/Functor/Identity/Compat.hs index 9129ae0..977c819 100644 --- a/base-compat/src/Data/Functor/Identity/Compat.hs +++ b/base-compat/src/Data/Functor/Identity/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Functor.Identity.Compat ( -#if MIN_VERSION_base(4,8,0) module Base -#endif ) where -#if MIN_VERSION_base(4,8,0) import Data.Functor.Identity as Base -#endif diff --git a/base-compat/src/Data/Functor/Identity/Compat/Repl.hs b/base-compat/src/Data/Functor/Identity/Compat/Repl.hs index a4d8414..0fa711e 100644 --- a/base-compat/src/Data/Functor/Identity/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Identity/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Identity.Compat" -- from a globally unique namespace. module Data.Functor.Identity.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Product/Compat.hs b/base-compat/src/Data/Functor/Product/Compat.hs index b756fc2..5bef327 100644 --- a/base-compat/src/Data/Functor/Product/Compat.hs +++ b/base-compat/src/Data/Functor/Product/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Functor.Product.Compat ( -#if MIN_VERSION_base(4,9,0) module Base -#endif ) where -#if MIN_VERSION_base(4,9,0) import Data.Functor.Product as Base -#endif diff --git a/base-compat/src/Data/Functor/Product/Compat/Repl.hs b/base-compat/src/Data/Functor/Product/Compat/Repl.hs index 271f799..177da8d 100644 --- a/base-compat/src/Data/Functor/Product/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Product/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Product.Compat" -- from a globally unique namespace. module Data.Functor.Product.Compat.Repl ( diff --git a/base-compat/src/Data/Functor/Sum/Compat.hs b/base-compat/src/Data/Functor/Sum/Compat.hs index b3435d8..1d93453 100644 --- a/base-compat/src/Data/Functor/Sum/Compat.hs +++ b/base-compat/src/Data/Functor/Sum/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Functor.Sum.Compat ( -#if MIN_VERSION_base(4,9,0) module Base -#endif ) where -#if MIN_VERSION_base(4,9,0) import Data.Functor.Sum as Base -#endif diff --git a/base-compat/src/Data/Functor/Sum/Compat/Repl.hs b/base-compat/src/Data/Functor/Sum/Compat/Repl.hs index 792861c..0ca01e4 100644 --- a/base-compat/src/Data/Functor/Sum/Compat/Repl.hs +++ b/base-compat/src/Data/Functor/Sum/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Functor.Sum.Compat" -- from a globally unique namespace. module Data.Functor.Sum.Compat.Repl ( diff --git a/base-compat/src/Data/IORef/Compat.hs b/base-compat/src/Data/IORef/Compat.hs index 9fe5f18..8e07fdc 100644 --- a/base-compat/src/Data/IORef/Compat.hs +++ b/base-compat/src/Data/IORef/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.IORef.Compat ( module Base , modifyIORef' @@ -7,36 +7,3 @@ module Data.IORef.Compat ( ) where import Data.IORef as Base - -#if !(MIN_VERSION_base(4,6,0)) -import Prelude - --- |Strict version of 'modifyIORef' --- --- /Since: 4.6.0.0/ -modifyIORef' :: IORef a -> (a -> a) -> IO () -modifyIORef' ref f = do - x <- readIORef ref - let x' = f x - x' `seq` writeIORef ref x' - --- | Strict version of 'atomicModifyIORef'. This forces both the value stored --- in the 'IORef' as well as the value returned. --- --- /Since: 4.6.0.0/ -atomicModifyIORef' :: IORef a -> (a -> (a,b)) -> IO b -atomicModifyIORef' ref f = do - b <- atomicModifyIORef ref $ \a -> - case f a of - v@(a',_) -> a' `seq` v - b `seq` return b - --- | Variant of 'writeIORef' with the \"barrier to reordering\" property that --- 'atomicModifyIORef' has. --- --- /Since: 4.6.0.0/ -atomicWriteIORef :: IORef a -> a -> IO () -atomicWriteIORef ref a = do - x <- atomicModifyIORef ref (\_ -> (a, ())) - x `seq` return () -#endif diff --git a/base-compat/src/Data/IORef/Compat/Repl.hs b/base-compat/src/Data/IORef/Compat/Repl.hs index 835357a..6c129ff 100644 --- a/base-compat/src/Data/IORef/Compat/Repl.hs +++ b/base-compat/src/Data/IORef/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.IORef.Compat" -- from a globally unique namespace. module Data.IORef.Compat.Repl ( diff --git a/base-compat/src/Data/List/Compat.hs b/base-compat/src/Data/List/Compat.hs index 89e15c8..cd4d72b 100644 --- a/base-compat/src/Data/List/Compat.hs +++ b/base-compat/src/Data/List/Compat.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} {-# LANGUAGE BangPatterns #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Data.List.Compat ( module Base @@ -22,85 +20,9 @@ module Data.List.Compat ( #if !(MIN_VERSION_base(4,11,0)) , iterate' #endif - -#if !(MIN_VERSION_base(4,8,0)) -, all -, and -, any -, concat -, concatMap -, elem -, find -, foldl -, foldl' -, foldl1 -, foldr -, foldr1 -, length -, maximum -, maximumBy -, minimum -, minimumBy -, notElem -, nub -, nubBy -, null -, or -, product -, sum -, union -, unionBy -, mapAccumL -, mapAccumR - -, isSubsequenceOf -, sortOn -, uncons -, scanl' -#endif - -#if !(MIN_VERSION_base(4,5,0)) -, dropWhileEnd -#endif ) where -#if MIN_VERSION_base(4,8,0) import Data.List as Base -#else -import Data.List as Base hiding ( - all - , and - , any - , concat - , concatMap - , elem - , find - , foldl - , foldl' - , foldl1 - , foldr - , foldr1 - , length - , maximum - , maximumBy - , minimum - , minimumBy - , notElem - , nub - , nubBy - , null - , or - , product - , sum - , union - , unionBy - , mapAccumL - , mapAccumR - ) -import Data.Foldable.Compat -import Data.Traversable -import Data.Ord (comparing) -#endif #if !(MIN_VERSION_base(4,11,0)) import GHC.Exts (build) @@ -114,125 +36,6 @@ import Prelude.Compat hiding (foldr, null) import GHC.List (List) #endif -#if !(MIN_VERSION_base(4,5,0)) --- | The 'dropWhileEnd' function drops the largest suffix of a list --- in which the given predicate holds for all elements. For example: --- --- > dropWhileEnd isSpace "foo\n" == "foo" --- > dropWhileEnd isSpace "foo bar" == "foo bar" --- > dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefined --- --- /Since: 4.5.0.0/ -dropWhileEnd :: (a -> Bool) -> [a] -> [a] -dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) [] - -#endif - -#if !(MIN_VERSION_base(4,8,0)) --- | The 'isSubsequenceOf' function takes two lists and returns 'True' if the --- first list is a subsequence of the second list. --- --- @'isSubsequenceOf' x y@ is equivalent to @'elem' x ('subsequences' y)@. --- --- /Since: 4.8.0.0/ --- --- ==== __Examples__ --- --- >>> isSubsequenceOf "GHC" "The Glorious Haskell Compiler" --- True --- >>> isSubsequenceOf ['a','d'..'z'] ['a'..'z'] --- True --- >>> isSubsequenceOf [1..10] [10,9..0] --- False -isSubsequenceOf :: (Eq a) => [a] -> [a] -> Bool -isSubsequenceOf [] _ = True -isSubsequenceOf _ [] = False -isSubsequenceOf a@(x:a') (y:b) | x == y = isSubsequenceOf a' b - | otherwise = isSubsequenceOf a b - --- | Sort a list by comparing the results of a key function applied to each --- element. @sortOn f@ is equivalent to @sortBy . comparing f@, but has the --- performance advantage of only evaluating @f@ once for each element in the --- input list. This is called the decorate-sort-undecorate paradigm, or --- Schwartzian transform. --- --- /Since: 4.8.0.0/ -sortOn :: Ord b => (a -> b) -> [a] -> [a] -sortOn f = - map snd . sortBy (comparing fst) . map (\x -> let y = f x in y `seq` (y, x)) - --- | Decompose a list into its head and tail. If the list is empty, --- returns 'Nothing'. If the list is non-empty, returns @'Just' (x, xs)@, --- where @x@ is the head of the list and @xs@ its tail. --- --- /Since: 4.8.0.0/ -uncons :: [a] -> Maybe (a, [a]) -uncons [] = Nothing -uncons (x:xs) = Just (x, xs) - --- | A strictly accumulating version of 'scanl' -{-# NOINLINE [1] scanl' #-} -scanl' :: (b -> a -> b) -> b -> [a] -> [b] --- This peculiar form is needed to prevent scanl' from being rewritten --- in its own right hand side. -scanl' = scanlGo' - where - scanlGo' :: (b -> a -> b) -> b -> [a] -> [b] - scanlGo' f !q ls = q : (case ls of - [] -> [] - x:xs -> scanlGo' f (f q x) xs) - --- | /O(n^2)/. The 'nub' function removes duplicate elements from a list. --- In particular, it keeps only the first occurrence of each element. --- (The name 'nub' means \`essence\'.) --- It is a special case of 'nubBy', which allows the programmer to supply --- their own equality test. -nub :: (Eq a) => [a] -> [a] -nub = nubBy (==) - - --- | The 'nubBy' function behaves just like 'nub', except it uses a --- user-supplied equality predicate instead of the overloaded '==' --- function. -nubBy :: (a -> a -> Bool) -> [a] -> [a] --- stolen from HBC -nubBy eq l = nubBy' l [] - where - nubBy' [] _ = [] - nubBy' (y:ys) xs - | elem_by eq y xs = nubBy' ys xs - | otherwise = y : nubBy' ys (y:xs) - --- Not exported: --- Note that we keep the call to `eq` with arguments in the --- same order as in the reference (prelude) implementation, --- and that this order is different from how `elem` calls (==). --- See #2528, #3280 and #7913. --- 'xs' is the list of things we've seen so far, --- 'y' is the potential new element -elem_by :: (a -> a -> Bool) -> a -> [a] -> Bool -elem_by _ _ [] = False -elem_by eq y (x:xs) = x `eq` y || elem_by eq y xs - --- | The 'union' function returns the list union of the two lists. --- For example, --- --- > "dog" `union` "cow" == "dogcw" --- --- Duplicates, and elements of the first list, are removed from the --- the second list, but if the first list contains duplicates, so will --- the result. --- It is a special case of 'unionBy', which allows the programmer to supply --- their own equality test. - -union :: (Eq a) => [a] -> [a] -> [a] -union = unionBy (==) - --- | The 'unionBy' function is the non-overloaded version of 'union'. -unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] -unionBy eq xs ys = xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs -#endif - #if !(MIN_VERSION_base(4,11,0)) -- | 'iterate\'' is the strict version of 'iterate'. -- diff --git a/base-compat/src/Data/List/Compat/Repl.hs b/base-compat/src/Data/List/Compat/Repl.hs index 98770e1..8057fa8 100644 --- a/base-compat/src/Data/List/Compat/Repl.hs +++ b/base-compat/src/Data/List/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.List.Compat" -- from a globally unique namespace. module Data.List.Compat.Repl ( diff --git a/base-compat/src/Data/List/NonEmpty/Compat.hs b/base-compat/src/Data/List/NonEmpty/Compat.hs index ca105fc..956e5f7 100644 --- a/base-compat/src/Data/List/NonEmpty/Compat.hs +++ b/base-compat/src/Data/List/NonEmpty/Compat.hs @@ -2,7 +2,6 @@ -- | This backports the modern "Data.Semigroup" interface back to -- @base-4.9@/GHC 8.0. module Data.List.NonEmpty.Compat ( -#if MIN_VERSION_base(4,9,0) -- * The type of non-empty streams NonEmpty(..) @@ -79,31 +78,27 @@ module Data.List.NonEmpty.Compat ( , toList , nonEmpty , xor -#endif ) where -#if MIN_VERSION_base(4,9,0) import Data.List.NonEmpty -# if !(MIN_VERSION_base(4,20,0)) +#if !(MIN_VERSION_base(4,20,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) -# if !(MIN_VERSION_base(4,15,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 +#endif -# if !(MIN_VERSION_base(4,16,0)) +#if !(MIN_VERSION_base(4,16,0)) -- | A monomorphic version of 'Prelude.<>' for 'NonEmpty'. -- -- >>> append (1 :| []) (2 :| [3]) @@ -138,9 +133,9 @@ prependList :: [a] -> NonEmpty a -> NonEmpty a prependList ls ne = case ls of [] -> ne (x : xs) -> x :| xs Prelude.<> toList ne -# endif +#endif -# if !(MIN_VERSION_base(4,18,0)) +#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. -- @@ -176,9 +171,9 @@ tails1 = -- - 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 -# if !(MIN_VERSION_base(4,20,0)) +#if !(MIN_VERSION_base(4,20,0)) -- | The 'permutations' function returns the list of all permutations of the argument. -- -- /Since: 4.20.0.0/ @@ -242,5 +237,4 @@ sortOn f = lift (List.sortOn f) -- this will raise an error. lift :: Foldable.Foldable f => ([a] -> [b]) -> f a -> NonEmpty b lift f = fromList . f . Foldable.toList -# endif #endif diff --git a/base-compat/src/Data/List/NonEmpty/Compat/Repl.hs b/base-compat/src/Data/List/NonEmpty/Compat/Repl.hs index f9c1944..ec54989 100644 --- a/base-compat/src/Data/List/NonEmpty/Compat/Repl.hs +++ b/base-compat/src/Data/List/NonEmpty/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.List.NonEmpty.Compat" -- from a globally unique namespace. module Data.List.NonEmpty.Compat.Repl ( diff --git a/base-compat/src/Data/Monoid/Compat.hs b/base-compat/src/Data/Monoid/Compat.hs index b47fae6..fe6ed81 100644 --- a/base-compat/src/Data/Monoid/Compat.hs +++ b/base-compat/src/Data/Monoid/Compat.hs @@ -1,26 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Monoid.Compat ( module Base , (<>) ) where -import Data.Monoid as Base -#if MIN_VERSION_base(4,9,0) - hiding ((<>)) -#endif -#if MIN_VERSION_base(4,9,0) +import Data.Monoid as Base hiding ((<>)) import Data.Semigroup ((<>)) -#endif - -#if !(MIN_VERSION_base(4,5,0)) && !(MIN_VERSION_base(4,9,0)) - -infixr 6 <> - --- | An infix synonym for 'mappend'. --- --- /Since: 4.5.0.0/ -(<>) :: Monoid m => m -> m -> m -(<>) = mappend -{-# INLINE (<>) #-} - -#endif diff --git a/base-compat/src/Data/Monoid/Compat/Repl.hs b/base-compat/src/Data/Monoid/Compat/Repl.hs index e476ecb..b2d2091 100644 --- a/base-compat/src/Data/Monoid/Compat/Repl.hs +++ b/base-compat/src/Data/Monoid/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Monoid.Compat" -- from a globally unique namespace. module Data.Monoid.Compat.Repl ( diff --git a/base-compat/src/Data/Proxy/Compat.hs b/base-compat/src/Data/Proxy/Compat.hs index fbe6201..308116a 100644 --- a/base-compat/src/Data/Proxy/Compat.hs +++ b/base-compat/src/Data/Proxy/Compat.hs @@ -1,17 +1,13 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} module Data.Proxy.Compat ( -#if MIN_VERSION_base(4,7,0) module Base, -#endif asProxyTypeOf ) where -#if MIN_VERSION_base(4,7,0) -# if MIN_VERSION_base(4,10,0) +#if MIN_VERSION_base(4,10,0) import Data.Proxy as Base -# else +#else import Data.Proxy as Base hiding (asProxyTypeOf) -# endif #endif #if !(MIN_VERSION_base(4,10,0)) diff --git a/base-compat/src/Data/Proxy/Compat/Repl.hs b/base-compat/src/Data/Proxy/Compat/Repl.hs index 94d695d..0668dc3 100644 --- a/base-compat/src/Data/Proxy/Compat/Repl.hs +++ b/base-compat/src/Data/Proxy/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Proxy.Compat" -- from a globally unique namespace. module Data.Proxy.Compat.Repl ( diff --git a/base-compat/src/Data/Ratio/Compat.hs b/base-compat/src/Data/Ratio/Compat.hs index 294b14f..c8b5c31 100644 --- a/base-compat/src/Data/Ratio/Compat.hs +++ b/base-compat/src/Data/Ratio/Compat.hs @@ -1,32 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Ratio.Compat ( module Base -#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,9,0)) -, denominator -, numerator -#endif ) where -#if !(MIN_VERSION_base(4,4,0)) || MIN_VERSION_base(4,9,0) import Data.Ratio as Base -#else -import Data.Ratio as Base hiding ( - denominator - , numerator - ) -import GHC.Real (Ratio(..)) -#endif - -#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,9,0)) --- | Extract the numerator of the ratio in reduced form: --- the numerator and denominator have no common factor and the denominator --- is positive. -numerator :: Ratio a -> a -numerator (x :% _) = x - --- | Extract the denominator of the ratio in reduced form: --- the numerator and denominator have no common factor and the denominator --- is positive. -denominator :: Ratio a -> a -denominator (_ :% y) = y -#endif diff --git a/base-compat/src/Data/Ratio/Compat/Repl.hs b/base-compat/src/Data/Ratio/Compat/Repl.hs index ec0bd22..9341b33 100644 --- a/base-compat/src/Data/Ratio/Compat/Repl.hs +++ b/base-compat/src/Data/Ratio/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Ratio.Compat" -- from a globally unique namespace. module Data.Ratio.Compat.Repl ( diff --git a/base-compat/src/Data/STRef/Compat.hs b/base-compat/src/Data/STRef/Compat.hs index 7701eac..e8634f6 100644 --- a/base-compat/src/Data/STRef/Compat.hs +++ b/base-compat/src/Data/STRef/Compat.hs @@ -1,24 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE Trustworthy #-} -#endif module Data.STRef.Compat ( module Base , modifySTRef' ) where import Data.STRef as Base - -#if !(MIN_VERSION_base(4,6,0)) -import Control.Monad.ST (ST) -import Prelude (seq) - --- | Strict version of 'modifySTRef' --- --- /Since: 4.6.0.0/ -modifySTRef' :: STRef s a -> (a -> a) -> ST s () -modifySTRef' ref f = do - x <- readSTRef ref - let x' = f x - x' `seq` writeSTRef ref x' -#endif diff --git a/base-compat/src/Data/STRef/Compat/Repl.hs b/base-compat/src/Data/STRef/Compat/Repl.hs index 780d59c..0b4fcf5 100644 --- a/base-compat/src/Data/STRef/Compat/Repl.hs +++ b/base-compat/src/Data/STRef/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.STRef.Compat" -- from a globally unique namespace. module Data.STRef.Compat.Repl ( diff --git a/base-compat/src/Data/Semigroup/Compat.hs b/base-compat/src/Data/Semigroup/Compat.hs index c8604bb..56a4467 100644 --- a/base-compat/src/Data/Semigroup/Compat.hs +++ b/base-compat/src/Data/Semigroup/Compat.hs @@ -1,8 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} -- | This backports the modern "Data.Semigroup" interface back to -- @base-4.9@/GHC 8.0. module Data.Semigroup.Compat ( -#if MIN_VERSION_base(4,9,0) Semigroup(..) , stimesMonoid , stimesIdempotent @@ -28,9 +27,6 @@ module Data.Semigroup.Compat ( , Arg(..) , ArgMin , ArgMax -#endif ) where -#if MIN_VERSION_base(4,9,0) import Data.Semigroup -#endif diff --git a/base-compat/src/Data/Semigroup/Compat/Repl.hs b/base-compat/src/Data/Semigroup/Compat/Repl.hs index e0d4ef1..2306b15 100644 --- a/base-compat/src/Data/Semigroup/Compat/Repl.hs +++ b/base-compat/src/Data/Semigroup/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Semigroup.Compat" -- from a globally unique namespace. module Data.Semigroup.Compat.Repl ( diff --git a/base-compat/src/Data/String/Compat.hs b/base-compat/src/Data/String/Compat.hs index 5ab61b4..5dfee2c 100644 --- a/base-compat/src/Data/String/Compat.hs +++ b/base-compat/src/Data/String/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.String.Compat ( module Base , String @@ -9,7 +9,3 @@ module Data.String.Compat ( ) where import Data.String as Base - -#if !(MIN_VERSION_base(4,4,0)) -import Prelude (String, lines, words, unlines, unwords) -#endif diff --git a/base-compat/src/Data/String/Compat/Repl.hs b/base-compat/src/Data/String/Compat/Repl.hs index 0392ed8..6885bb8 100644 --- a/base-compat/src/Data/String/Compat/Repl.hs +++ b/base-compat/src/Data/String/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.String.Compat" -- from a globally unique namespace. module Data.String.Compat.Repl ( diff --git a/base-compat/src/Data/Traversable/Compat.hs b/base-compat/src/Data/Traversable/Compat.hs index 1b61c09..459c3f5 100644 --- a/base-compat/src/Data/Traversable/Compat.hs +++ b/base-compat/src/Data/Traversable/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif #if !(MIN_VERSION_base(4,18,0)) {-# LANGUAGE ScopedTypeVariables #-} #endif @@ -18,11 +16,7 @@ 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)) @@ -50,13 +44,8 @@ instance Monad m => Applicative (StateT s m) where 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 diff --git a/base-compat/src/Data/Traversable/Compat/Repl.hs b/base-compat/src/Data/Traversable/Compat/Repl.hs index 71301ac..dee77ef 100644 --- a/base-compat/src/Data/Traversable/Compat/Repl.hs +++ b/base-compat/src/Data/Traversable/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Traversable.Compat" -- from a globally unique namespace. module Data.Traversable.Compat.Repl ( diff --git a/base-compat/src/Data/Tuple/Compat.hs b/base-compat/src/Data/Tuple/Compat.hs index 38ca253..92c27be 100644 --- a/base-compat/src/Data/Tuple/Compat.hs +++ b/base-compat/src/Data/Tuple/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} -#endif #if MIN_VERSION_ghc_prim(0,7,0) {-# LANGUAGE PatternSynonyms #-} #endif diff --git a/base-compat/src/Data/Tuple/Compat/Repl.hs b/base-compat/src/Data/Tuple/Compat/Repl.hs index adab60a..53ebb6e 100644 --- a/base-compat/src/Data/Tuple/Compat/Repl.hs +++ b/base-compat/src/Data/Tuple/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Tuple.Compat" -- from a globally unique namespace. module Data.Tuple.Compat.Repl ( diff --git a/base-compat/src/Data/Type/Coercion/Compat.hs b/base-compat/src/Data/Type/Coercion/Compat.hs index 3dbd8c7..1897870 100644 --- a/base-compat/src/Data/Type/Coercion/Compat.hs +++ b/base-compat/src/Data/Type/Coercion/Compat.hs @@ -1,16 +1,11 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} {-# LANGUAGE RankNTypes #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Data.Type.Coercion.Compat ( -#if MIN_VERSION_base(4,7,0) module Base , gcoerceWith -#endif ) where -#if MIN_VERSION_base(4,7,0) import Data.Type.Coercion as Base # if !(MIN_VERSION_base(4,10,0)) @@ -22,4 +17,3 @@ import Data.Coerce (Coercible) gcoerceWith :: Coercion a b -> (Coercible a b => r) -> r gcoerceWith Coercion x = x # endif -#endif diff --git a/base-compat/src/Data/Type/Coercion/Compat/Repl.hs b/base-compat/src/Data/Type/Coercion/Compat/Repl.hs index 8f3b7fb..ca53047 100644 --- a/base-compat/src/Data/Type/Coercion/Compat/Repl.hs +++ b/base-compat/src/Data/Type/Coercion/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Type.Coercion.Compat" -- from a globally unique namespace. module Data.Type.Coercion.Compat.Repl ( diff --git a/base-compat/src/Data/Type/Equality/Compat.hs b/base-compat/src/Data/Type/Equality/Compat.hs index 213a17c..9674698 100644 --- a/base-compat/src/Data/Type/Equality/Compat.hs +++ b/base-compat/src/Data/Type/Equality/Compat.hs @@ -1,14 +1,8 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RankNTypes #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Data.Type.Equality.Compat ( -#if MIN_VERSION_base(4,7,0) module Base -#endif ) where -#if MIN_VERSION_base(4,7,0) import Data.Type.Equality as Base -#endif diff --git a/base-compat/src/Data/Type/Equality/Compat/Repl.hs b/base-compat/src/Data/Type/Equality/Compat/Repl.hs index 46bed84..f15fdb5 100644 --- a/base-compat/src/Data/Type/Equality/Compat/Repl.hs +++ b/base-compat/src/Data/Type/Equality/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Type.Equality.Compat" -- from a globally unique namespace. module Data.Type.Equality.Compat.Repl ( diff --git a/base-compat/src/Data/Typeable/Compat.hs b/base-compat/src/Data/Typeable/Compat.hs index a58c00f..224a1db 100644 --- a/base-compat/src/Data/Typeable/Compat.hs +++ b/base-compat/src/Data/Typeable/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif #if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,19,0)) {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} diff --git a/base-compat/src/Data/Typeable/Compat/Repl.hs b/base-compat/src/Data/Typeable/Compat/Repl.hs index 7e91bc2..8d7396d 100644 --- a/base-compat/src/Data/Typeable/Compat/Repl.hs +++ b/base-compat/src/Data/Typeable/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Typeable.Compat" -- from a globally unique namespace. module Data.Typeable.Compat.Repl ( diff --git a/base-compat/src/Data/Version/Compat.hs b/base-compat/src/Data/Version/Compat.hs index 539e9cb..a236c4a 100644 --- a/base-compat/src/Data/Version/Compat.hs +++ b/base-compat/src/Data/Version/Compat.hs @@ -1,16 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Version.Compat ( module Base , makeVersion ) where import Data.Version as Base - -#if !(MIN_VERSION_base(4,8,0)) -import Prelude.Compat - --- | Construct tag-less 'Version' --- --- /Since: 4.8.0.0/ -makeVersion :: [Int] -> Version -makeVersion b = Version b [] -#endif diff --git a/base-compat/src/Data/Version/Compat/Repl.hs b/base-compat/src/Data/Version/Compat/Repl.hs index 447d58a..ad4ee69 100644 --- a/base-compat/src/Data/Version/Compat/Repl.hs +++ b/base-compat/src/Data/Version/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Version.Compat" -- from a globally unique namespace. module Data.Version.Compat.Repl ( diff --git a/base-compat/src/Data/Void/Compat.hs b/base-compat/src/Data/Void/Compat.hs index e7ca1f8..d757a9d 100644 --- a/base-compat/src/Data/Void/Compat.hs +++ b/base-compat/src/Data/Void/Compat.hs @@ -1,10 +1,6 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Void.Compat ( -#if MIN_VERSION_base(4,8,0) module Base -#endif ) where -#if MIN_VERSION_base(4,8,0) import Data.Void as Base -#endif diff --git a/base-compat/src/Data/Void/Compat/Repl.hs b/base-compat/src/Data/Void/Compat/Repl.hs index 57c96ed..ac026d9 100644 --- a/base-compat/src/Data/Void/Compat/Repl.hs +++ b/base-compat/src/Data/Void/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Void.Compat" -- from a globally unique namespace. module Data.Void.Compat.Repl ( diff --git a/base-compat/src/Data/Word/Compat.hs b/base-compat/src/Data/Word/Compat.hs index 0135e0d..9232114 100644 --- a/base-compat/src/Data/Word/Compat.hs +++ b/base-compat/src/Data/Word/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Data.Word.Compat ( module Base , byteSwap16 @@ -7,36 +7,3 @@ module Data.Word.Compat ( ) where import Data.Word as Base - -#if !(MIN_VERSION_base(4,7,0)) -import Data.Bits - --- | Swap bytes in 'Word16'. --- --- /Since: 4.7.0.0/ -byteSwap16 :: Word16 -> Word16 -byteSwap16 w = ((w `shiftR` 8) .&. 0x00ff) - .|. ((w .&. 0x00ff) `shiftL` 8) - --- | Reverse order of bytes in 'Word32'. --- --- /Since: 4.7.0.0/ -byteSwap32 :: Word32 -> Word32 -byteSwap32 w = ((w .&. 0xff000000) `shiftR` 24) - .|. ((w .&. 0x00ff0000) `shiftR` 8) - .|. ((w .&. 0x0000ff00) `shiftL` 8) - .|. ((w .&. 0x000000ff) `shiftL` 24) - --- | Reverse order of bytes in 'Word64'. --- --- /Since: 4.7.0.0/ -byteSwap64 :: Word64 -> Word64 -byteSwap64 w = ((w .&. 0xff00000000000000) `shiftR` 56) - .|. ((w .&. 0x00ff000000000000) `shiftR` 40) - .|. ((w .&. 0x0000ff0000000000) `shiftR` 24) - .|. ((w .&. 0x000000ff00000000) `shiftR` 8) - .|. ((w .&. 0x00000000ff000000) `shiftL` 8) - .|. ((w .&. 0x0000000000ff0000) `shiftL` 24) - .|. ((w .&. 0x000000000000ff00) `shiftL` 40) - .|. ((w .&. 0x00000000000000ff) `shiftL` 56) -#endif diff --git a/base-compat/src/Data/Word/Compat/Repl.hs b/base-compat/src/Data/Word/Compat/Repl.hs index 2bc5b2f..e780c4c 100644 --- a/base-compat/src/Data/Word/Compat/Repl.hs +++ b/base-compat/src/Data/Word/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Data.Word.Compat" -- from a globally unique namespace. module Data.Word.Compat.Repl ( diff --git a/base-compat/src/Debug/Trace/Compat.hs b/base-compat/src/Debug/Trace/Compat.hs index 164659a..cde0a7c 100644 --- a/base-compat/src/Debug/Trace/Compat.hs +++ b/base-compat/src/Debug/Trace/Compat.hs @@ -7,80 +7,15 @@ module Debug.Trace.Compat ( , 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) import Debug.Trace as Base -#else -import Debug.Trace as Base hiding ( - traceM - , traceShowM - ) -#endif #if !(MIN_VERSION_base(4,18,0)) import Prelude.Compat #endif -#if !(MIN_VERSION_base(4,7,0)) -{-| -Like 'trace' but returns the message instead of a third value. - -/Since: 4.7.0.0/ --} -traceId :: String -> String -traceId a = trace a a - -{-| -Like 'traceShow' but returns the shown value instead of a third value. - -/Since: 4.7.0.0/ --} -traceShowId :: (Show a) => a -> a -traceShowId a = trace (show a) a -#endif - -#if !(MIN_VERSION_base(4,9,0)) -{-| -Like 'trace' but returning unit in an arbitrary 'Applicative' context. Allows -for convenient use in do-notation. - -Note that the application of 'traceM' is not an action in the 'Applicative' -context, as 'traceIO' is in the 'IO' type. While the fresh bindings in the -following example will force the 'traceM' expressions to be reduced every time -the @do@-block is executed, @traceM "not crashed"@ would only be reduced once, -and the message would only be printed once. If your monad is in 'MonadIO', -@liftIO . traceIO@ may be a better option. - -> ... = do -> x <- ... -> traceM $ "x: " ++ show x -> y <- ... -> traceM $ "y: " ++ show y - -/Since: 4.7.0.0/ --} -traceM :: (Applicative f) => String -> f () -traceM string = trace string $ pure () - -{-| -Like 'traceM', but uses 'show' on the argument to convert it to a 'String'. - -> ... = do -> x <- ... -> traceShowM $ x -> y <- ... -> traceShowM $ x + y - -/Since: 4.7.0.0/ --} -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. @@ -107,12 +42,10 @@ a 'String'. 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 --git a/base-compat/src/Debug/Trace/Compat/Repl.hs b/base-compat/src/Debug/Trace/Compat/Repl.hs index 473ff27..fa91cd4 100644 --- a/base-compat/src/Debug/Trace/Compat/Repl.hs +++ b/base-compat/src/Debug/Trace/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Debug.Trace.Compat" -- from a globally unique namespace. module Debug.Trace.Compat.Repl ( diff --git a/base-compat/src/Foreign/Compat.hs b/base-compat/src/Foreign/Compat.hs index 0baf77c..7dbc2a9 100644 --- a/base-compat/src/Foreign/Compat.hs +++ b/base-compat/src/Foreign/Compat.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE Trustworthy #-} -#endif module Foreign.Compat ( module Base , module Marshal diff --git a/base-compat/src/Foreign/Compat/Repl.hs b/base-compat/src/Foreign/Compat/Repl.hs index eec65cb..45b0c40 100644 --- a/base-compat/src/Foreign/Compat/Repl.hs +++ b/base-compat/src/Foreign/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Compat" -- from a globally unique namespace. module Foreign.Compat.Repl ( diff --git a/base-compat/src/Foreign/ForeignPtr/Compat.hs b/base-compat/src/Foreign/ForeignPtr/Compat.hs index 87f1389..b5d8668 100644 --- a/base-compat/src/Foreign/ForeignPtr/Compat.hs +++ b/base-compat/src/Foreign/ForeignPtr/Compat.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} {-# LANGUAGE MagicHash #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Foreign.ForeignPtr.Compat ( module Base , plusForeignPtr diff --git a/base-compat/src/Foreign/ForeignPtr/Compat/Repl.hs b/base-compat/src/Foreign/ForeignPtr/Compat/Repl.hs index 288f909..cbe2745 100644 --- a/base-compat/src/Foreign/ForeignPtr/Compat/Repl.hs +++ b/base-compat/src/Foreign/ForeignPtr/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Compat.Repl ( diff --git a/base-compat/src/Foreign/ForeignPtr/Safe/Compat.hs b/base-compat/src/Foreign/ForeignPtr/Safe/Compat.hs index 6ba85b5..c84d46f 100644 --- a/base-compat/src/Foreign/ForeignPtr/Safe/Compat.hs +++ b/base-compat/src/Foreign/ForeignPtr/Safe/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Foreign.ForeignPtr.Safe.Compat ( -- * Finalised data pointers ForeignPtr diff --git a/base-compat/src/Foreign/ForeignPtr/Safe/Compat/Repl.hs b/base-compat/src/Foreign/ForeignPtr/Safe/Compat/Repl.hs index 67a9079..8423102 100644 --- a/base-compat/src/Foreign/ForeignPtr/Safe/Compat/Repl.hs +++ b/base-compat/src/Foreign/ForeignPtr/Safe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Safe.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Safe.Compat.Repl ( diff --git a/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat.hs b/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat.hs index 62d4844..9ce1d51 100644 --- a/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat.hs +++ b/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat.hs @@ -1,11 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Foreign.ForeignPtr.Unsafe.Compat ( -- ** Unsafe low-level operations unsafeForeignPtrToPtr ) where -#if MIN_VERSION_base(4,6,0) import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) -#else -import Foreign.ForeignPtr (unsafeForeignPtrToPtr) -#endif diff --git a/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat/Repl.hs b/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat/Repl.hs index e7ac3fb..dcc9d32 100644 --- a/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat/Repl.hs +++ b/base-compat/src/Foreign/ForeignPtr/Unsafe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.ForeignPtr.Unsafe.Compat" -- from a globally unique namespace. module Foreign.ForeignPtr.Unsafe.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Alloc/Compat.hs b/base-compat/src/Foreign/Marshal/Alloc/Compat.hs index edc0dbf..af7ee21 100644 --- a/base-compat/src/Foreign/Marshal/Alloc/Compat.hs +++ b/base-compat/src/Foreign/Marshal/Alloc/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ForeignFunctionInterface #-} module Foreign.Marshal.Alloc.Compat ( module Base @@ -6,38 +6,3 @@ module Foreign.Marshal.Alloc.Compat ( , callocBytes ) where import Foreign.Marshal.Alloc as Base - -#if !(MIN_VERSION_base(4,8,0)) -import Foreign.C.Types -import Foreign.Ptr (Ptr, nullPtr) -import Foreign.Storable (Storable(..)) -import GHC.IO.Exception -import Prelude.Compat - --- |Like 'malloc' but memory is filled with bytes of value zero. --- -{-# INLINE calloc #-} -calloc :: Storable a => IO (Ptr a) -calloc = doCalloc undefined - where - doCalloc :: Storable b => b -> IO (Ptr b) - doCalloc dummy = callocBytes (sizeOf dummy) - --- |Llike 'mallocBytes' but memory is filled with bytes of value zero. --- -callocBytes :: Int -> IO (Ptr a) -callocBytes size = failWhenNULL "calloc" $ _calloc 1 (fromIntegral size) - --- asserts that the pointer returned from the action in the second argument is --- non-null --- -failWhenNULL :: String -> IO (Ptr a) -> IO (Ptr a) -failWhenNULL name f = do - addr <- f - if addr == nullPtr - then ioError (IOError Nothing ResourceExhausted name - "out of memory" Nothing Nothing) - else return addr - -foreign import ccall unsafe "stdlib.h calloc" _calloc :: CSize -> CSize -> IO (Ptr a) -#endif diff --git a/base-compat/src/Foreign/Marshal/Alloc/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Alloc/Compat/Repl.hs index c022a78..8e67994 100644 --- a/base-compat/src/Foreign/Marshal/Alloc/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Alloc/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Alloc.Compat" -- from a globally unique namespace. module Foreign.Marshal.Alloc.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Array/Compat.hs b/base-compat/src/Foreign/Marshal/Array/Compat.hs index 79b160a..3f4a8d8 100644 --- a/base-compat/src/Foreign/Marshal/Array/Compat.hs +++ b/base-compat/src/Foreign/Marshal/Array/Compat.hs @@ -1,28 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Foreign.Marshal.Array.Compat ( module Base , callocArray , callocArray0 ) where import Foreign.Marshal.Array as Base - -#if !(MIN_VERSION_base(4,8,0)) -import Foreign.Marshal.Alloc.Compat -import Foreign.Ptr (Ptr) -import Foreign.Storable (Storable(..)) -import Prelude.Compat - --- |Like 'mallocArray', but allocated memory is filled with bytes of value zero. --- -callocArray :: Storable a => Int -> IO (Ptr a) -callocArray = doCalloc undefined - where - doCalloc :: Storable a' => a' -> Int -> IO (Ptr a') - doCalloc dummy size = callocBytes (size * sizeOf dummy) - --- |Like 'callocArray0', but allocated memory is filled with bytes of value --- zero. --- -callocArray0 :: Storable a => Int -> IO (Ptr a) -callocArray0 size = callocArray (size + 1) -#endif diff --git a/base-compat/src/Foreign/Marshal/Array/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Array/Compat/Repl.hs index b51dd07..9ee2f1c 100644 --- a/base-compat/src/Foreign/Marshal/Array/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Array/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Array.Compat" -- from a globally unique namespace. module Foreign.Marshal.Array.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Compat.hs b/base-compat/src/Foreign/Marshal/Compat.hs index 4697ba8..4a637d0 100644 --- a/base-compat/src/Foreign/Marshal/Compat.hs +++ b/base-compat/src/Foreign/Marshal/Compat.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE Trustworthy #-} -#endif module Foreign.Marshal.Compat ( module Base , module Alloc diff --git a/base-compat/src/Foreign/Marshal/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Compat/Repl.hs index 9a14bfc..6415213 100644 --- a/base-compat/src/Foreign/Marshal/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Compat" -- from a globally unique namespace. module Foreign.Marshal.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Safe/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Safe/Compat/Repl.hs index a1c139b..b2ecba2 100644 --- a/base-compat/src/Foreign/Marshal/Safe/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Safe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Safe.Compat" -- from a globally unique namespace. module Foreign.Marshal.Safe.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Unsafe/Compat.hs b/base-compat/src/Foreign/Marshal/Unsafe/Compat.hs index d0748d8..80a6d8f 100644 --- a/base-compat/src/Foreign/Marshal/Unsafe/Compat.hs +++ b/base-compat/src/Foreign/Marshal/Unsafe/Compat.hs @@ -1,11 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Foreign.Marshal.Unsafe.Compat ( -- * Unsafe functions unsafeLocalState ) where -#if MIN_VERSION_base(4,6,0) import Foreign.Marshal.Unsafe (unsafeLocalState) -#else -import Foreign.Marshal (unsafeLocalState) -#endif diff --git a/base-compat/src/Foreign/Marshal/Unsafe/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Unsafe/Compat/Repl.hs index 16c5825..8ae0c5a 100644 --- a/base-compat/src/Foreign/Marshal/Unsafe/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Unsafe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Unsafe.Compat" -- from a globally unique namespace. module Foreign.Marshal.Unsafe.Compat.Repl ( diff --git a/base-compat/src/Foreign/Marshal/Utils/Compat.hs b/base-compat/src/Foreign/Marshal/Utils/Compat.hs index b1d0b62..22374ab 100644 --- a/base-compat/src/Foreign/Marshal/Utils/Compat.hs +++ b/base-compat/src/Foreign/Marshal/Utils/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ForeignFunctionInterface #-} module Foreign.Marshal.Utils.Compat ( module Base @@ -6,20 +6,3 @@ module Foreign.Marshal.Utils.Compat ( ) where import Foreign.Marshal.Utils as Base - -#if !(MIN_VERSION_base(4,8,0)) -import Data.Word (Word8) -import Foreign.C.Types -import Foreign.Ptr -import Prelude - --- |Fill a given number of bytes in memory area with a byte value. --- --- /Since: 4.8.0.0/ -fillBytes :: Ptr a -> Word8 -> Int -> IO () -fillBytes dest char size = do - _ <- memset dest (fromIntegral char) (fromIntegral size) - return () - -foreign import ccall unsafe "string.h" memset :: Ptr a -> CInt -> CSize -> IO (Ptr a) -#endif diff --git a/base-compat/src/Foreign/Marshal/Utils/Compat/Repl.hs b/base-compat/src/Foreign/Marshal/Utils/Compat/Repl.hs index 7ce54e3..1b771ca 100644 --- a/base-compat/src/Foreign/Marshal/Utils/Compat/Repl.hs +++ b/base-compat/src/Foreign/Marshal/Utils/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Foreign.Marshal.Utils.Compat" -- from a globally unique namespace. module Foreign.Marshal.Utils.Compat.Repl ( diff --git a/base-compat/src/Numeric/Compat.hs b/base-compat/src/Numeric/Compat.hs index a66684e..69ddc34 100644 --- a/base-compat/src/Numeric/Compat.hs +++ b/base-compat/src/Numeric/Compat.hs @@ -10,10 +10,6 @@ module Numeric.Compat ( import Numeric as Base -#if !(MIN_VERSION_base(4,7,0)) -import GHC.Float -#endif - #if !(MIN_VERSION_base(4,16,0)) import Data.Char (intToDigit) import Prelude @@ -21,93 +17,6 @@ import Text.ParserCombinators.ReadP (readP_to_S) import qualified Text.Read.Lex.Compat as L #endif -#if !(MIN_VERSION_base(4,7,0)) --- | Show a signed 'RealFloat' value --- using standard decimal notation (e.g. @245000@, @0.0015@). --- --- This behaves as 'showFFloat', except that a decimal point --- is always guaranteed, even if not needed. --- --- /Since: 4.7.0.0/ -showFFloatAlt :: (RealFloat a) => Maybe Int -> a -> ShowS -showFFloatAlt d x = showString (formatRealFloatAlt FFFixed d True x) - --- | Show a signed 'RealFloat' value --- using standard decimal notation for arguments whose absolute value lies --- between @0.1@ and @9,999,999@, and scientific notation otherwise. --- --- This behaves as 'showFFloat', except that a decimal point --- is always guaranteed, even if not needed. --- --- /Since: 4.7.0.0/ -showGFloatAlt :: (RealFloat a) => Maybe Int -> a -> ShowS -showGFloatAlt d x = showString (formatRealFloatAlt FFGeneric d True x) - -formatRealFloatAlt :: (RealFloat a) => FFFormat -> Maybe Int -> Bool -> a - -> String -formatRealFloatAlt fmt decs alt x - | isNaN x = "NaN" - | isInfinite x = if x < 0 then "-Infinity" else "Infinity" - | x < 0 || isNegativeZero x = '-':doFmt fmt (floatToDigits (toInteger base) (-x)) - | otherwise = doFmt fmt (floatToDigits (toInteger base) x) - where - base = 10 - - doFmt format (is, e) = - let ds = map intToDigit is in - case format of - FFGeneric -> - doFmt (if e < 0 || e > 7 then FFExponent else FFFixed) - (is,e) - FFExponent -> - case decs of - Nothing -> - let show_e' = show (e-1) in - case ds of - "0" -> "0.0e0" - [d] -> d : ".0e" ++ show_e' - (d:ds') -> d : '.' : ds' ++ "e" ++ show_e' - [] -> error "formatRealFloat/doFmt/FFExponent: []" - Just dec -> - let dec' = max dec 1 in - case is of - [0] -> '0' :'.' : take dec' (repeat '0') ++ "e0" - _ -> - let - (ei,is') = roundTo base (dec'+1) is - (d:ds') = map intToDigit (if ei > 0 then init is' else is') - in - d:'.':ds' ++ 'e':show (e-1+ei) - FFFixed -> - let - mk0 ls = case ls of { "" -> "0" ; _ -> ls} - in - case decs of - Nothing - | e <= 0 -> "0." ++ replicate (-e) '0' ++ ds - | otherwise -> - let - f 0 s rs = mk0 (reverse s) ++ '.':mk0 rs - f n s "" = f (n-1) ('0':s) "" - f n s (r:rs) = f (n-1) (r:s) rs - in - f e "" ds - Just dec -> - let dec' = max dec 0 in - if e >= 0 then - let - (ei,is') = roundTo base (dec' + e) is - (ls,rs) = splitAt (e+ei) (map intToDigit is') - in - mk0 ls ++ (if null rs && not alt then "" else '.':rs) - else - let - (ei,is') = roundTo base dec' (replicate (-e) 0 ++ is) - d:ds' = map intToDigit (if ei > 0 then is' else 0:is') - in - d : (if null ds' && not alt then "" else '.':ds') -#endif - #if !(MIN_VERSION_base(4,11,0)) {- | Show a floating-point value in the hexadecimal format, similar to the @%a@ specifier in C's printf. diff --git a/base-compat/src/Numeric/Compat/Repl.hs b/base-compat/src/Numeric/Compat/Repl.hs index 88a2059..0822327 100644 --- a/base-compat/src/Numeric/Compat/Repl.hs +++ b/base-compat/src/Numeric/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Numeric.Compat" -- from a globally unique namespace. module Numeric.Compat.Repl ( diff --git a/base-compat/src/Numeric/Natural/Compat.hs b/base-compat/src/Numeric/Natural/Compat.hs index 32747ca..c5a7bde 100644 --- a/base-compat/src/Numeric/Natural/Compat.hs +++ b/base-compat/src/Numeric/Natural/Compat.hs @@ -1,18 +1,12 @@ {-# 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)) +#if !(MIN_VERSION_base(4,18,0)) import GHC.Natural (minusNaturalMaybe) -# endif #endif diff --git a/base-compat/src/Numeric/Natural/Compat/Repl.hs b/base-compat/src/Numeric/Natural/Compat/Repl.hs index 6965ff7..bd47e4a 100644 --- a/base-compat/src/Numeric/Natural/Compat/Repl.hs +++ b/base-compat/src/Numeric/Natural/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Numeric.Natural.Compat" -- from a globally unique namespace. module Numeric.Natural.Compat.Repl ( diff --git a/base-compat/src/Prelude/Compat.hs b/base-compat/src/Prelude/Compat.hs index 9ec33b3..c225140 100644 --- a/base-compat/src/Prelude/Compat.hs +++ b/base-compat/src/Prelude/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif #if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,12,0)) {-# LANGUAGE BangPatterns #-} {-# LANGUAGE RankNTypes #-} @@ -147,9 +145,7 @@ module Prelude.Compat ( , mappend , mconcat , mempty -# if MIN_VERSION_base(4,9,0) , (<>) -# endif , maxBound , minBound , enumFrom @@ -240,9 +236,7 @@ module Prelude.Compat ( , Functor , Integral , Monad -#if MIN_VERSION_base(4,9,0) , MonadFail -#endif , Monoid , Num (fromInteger) , Ord @@ -250,9 +244,7 @@ module Prelude.Compat ( , Real , RealFloat , RealFrac -# if MIN_VERSION_base(4,9,0) , Semigroup -# endif , Show , Traversable @@ -285,69 +277,28 @@ module Prelude.Compat ( ) where -#if MIN_VERSION_base(4,9,0) - import Prelude as Base hiding ( -# if !(MIN_VERSION_base(4,13,0)) +#if !(MIN_VERSION_base(4,13,0)) fail -# if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,12,0)) +# if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,12,0)) , ($!) -# endif # endif +#endif ) -# if !(MIN_VERSION_base(4,18,0)) +#if !(MIN_VERSION_base(4,18,0)) import Control.Applicative (liftA2) -# endif +#endif -# if !(MIN_VERSION_base(4,20,0)) +#if !(MIN_VERSION_base(4,20,0)) import Data.Foldable (foldl') -# endif - -#else - -import Prelude hiding ( - length - , null - , foldr - , mapM - , sequence - , all - , and - , any - , concat - , concatMap - , mapM - , mapM_ - , notElem - , or - , sequence - , sequence_ - , elem - , foldl - , foldl1 - , foldr1 - , maximum - , minimum - , product - , sum - ) - -import Control.Applicative -import Data.Foldable.Compat -import Data.Traversable - -# if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid -import Data.Word -# endif #endif -#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0)) +#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup as Base (Semigroup((<>))) #endif -#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,13,0)) +#if !(MIN_VERSION_base(4,13,0)) import Control.Monad.Fail as Base (MonadFail(fail)) #endif @@ -355,15 +306,6 @@ import Control.Monad.Fail as Base (MonadFail(fail)) import GHC.Exts (TYPE) #endif -#if !(MIN_VERSION_base(4,9,0)) --- | A variant of 'error' that does not produce a stack trace. --- --- /Since: 4.9.0.0/ -errorWithoutStackTrace :: [Char] -> a -errorWithoutStackTrace s = error s -{-# NOINLINE errorWithoutStackTrace #-} -#endif - #if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,12,0)) -- | Strict (call-by-value) application operator. It takes a function and an -- argument, evaluates the argument to weak head normal form (WHNF), then calls diff --git a/base-compat/src/Prelude/Compat/Repl.hs b/base-compat/src/Prelude/Compat/Repl.hs index f131556..22b368d 100644 --- a/base-compat/src/Prelude/Compat/Repl.hs +++ b/base-compat/src/Prelude/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Prelude.Compat" -- from a globally unique namespace. module Prelude.Compat.Repl ( diff --git a/base-compat/src/System/Environment/Compat.hs b/base-compat/src/System/Environment/Compat.hs index a32ac67..1caf8e6 100644 --- a/base-compat/src/System/Environment/Compat.hs +++ b/base-compat/src/System/Environment/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE ForeignFunctionInterface #-} -- | Miscellaneous information about the system environment. module System.Environment.Compat ( @@ -14,122 +14,3 @@ module System.Environment.Compat ( ) where import System.Environment - -#if !(MIN_VERSION_base(4,7,0)) -import Prelude.Compat - -# ifdef mingw32_HOST_OS -import Control.Monad -import Foreign.C -import Foreign.Safe -import GHC.Windows -# else -import qualified System.Posix.Env as Posix -# endif - -# ifdef mingw32_HOST_OS - -# if defined(i386_HOST_ARCH) -# define WINDOWS_CCONV stdcall -# elif defined(x86_64_HOST_ARCH) -# define WINDOWS_CCONV ccall -# else -# error Unknown mingw32 arch -# endif - -foreign import WINDOWS_CCONV unsafe "windows.h GetLastError" - c_GetLastError:: IO DWORD - -eRROR_ENVVAR_NOT_FOUND :: DWORD -eRROR_ENVVAR_NOT_FOUND = 203 - -# endif - -# if !(MIN_VERSION_base(4,6,0)) --- | Return the value of the environment variable @var@, or @Nothing@ if --- there is no such value. --- --- For POSIX users, this is equivalent to 'System.Posix.Env.getEnv'. -lookupEnv :: String -> IO (Maybe String) -lookupEnv k = lookup k `fmap` getEnvironment -# endif - --- | @setEnv name value@ sets the specified environment variable to @value@. --- --- On Windows setting an environment variable to the /empty string/ removes --- that environment variable from the environment. For the sake of --- compatibility we adopt that behavior. In particular --- --- @ --- setEnv name \"\" --- @ --- --- has the same effect as --- --- @ --- `unsetEnv` name --- @ --- --- If you don't care about Windows support and want to set an environment --- variable to the empty string use @System.Posix.Env.setEnv@ from the @unix@ --- package instead. --- --- Throws `Control.Exception.IOException` if @name@ is the empty string or --- contains an equals sign. --- --- Note that setting Unicode values may not work correctly on versions of GHC --- prior to 7.2. -setEnv :: String -> String -> IO () -setEnv key value_ - | null value = unsetEnv key - | otherwise = setEnv_ key value - where - -- NOTE: Anything that follows NUL is ignored on both POSIX and Windows. - -- We still strip it manually so that the null check above succeds if a - -- value starts with NUL, and `unsetEnv` is called. This is important for - -- two reasons. - -- - -- * On POSIX setting an environment variable to the empty string does not - -- remove it. - -- - -- * On Windows setting an environment variable to the empty string - -- removes that environment variable. A subsequent call to - -- GetEnvironmentVariable will then return 0, but the calling thread's - -- last-error code will not be updated, and hence a call to GetLastError - -- may not return ERROR_ENVVAR_NOT_FOUND. The failed lookup will then - -- result in a random error instead of the expected - -- `isDoesNotExistError` (this is at least true for Windows XP, SP 3). - -- Explicitly calling `unsetEnv` prevents this. - value = takeWhile (/= '\NUL') value_ - -setEnv_ :: String -> String -> IO () -# ifdef mingw32_HOST_OS -setEnv_ key value = withCWString key $ \k -> withCWString value $ \v -> do - success <- c_SetEnvironmentVariable k v - unless success (throwGetLastError "setEnv") - -foreign import WINDOWS_CCONV unsafe "windows.h SetEnvironmentVariableW" - c_SetEnvironmentVariable :: LPTSTR -> LPTSTR -> IO Bool -# else -setEnv_ k v = Posix.setEnv k v True -# endif - --- | @unsetEnv name@ removes the specified environment variable from the --- environment of the current process. --- --- Throws `Control.Exception.IOException` if @name@ is the empty string or --- contains an equals sign. -unsetEnv :: String -> IO () -# ifdef mingw32_HOST_OS -unsetEnv key = withCWString key $ \k -> do - success <- c_SetEnvironmentVariable k nullPtr - unless success $ do - -- We consider unsetting an environment variable that does not exist not as - -- an error, hence we ignore eRROR_ENVVAR_NOT_FOUND. - err <- c_GetLastError - unless (err == eRROR_ENVVAR_NOT_FOUND) $ do - throwGetLastError "unsetEnv" -# else -unsetEnv = Posix.unsetEnv -# endif -#endif diff --git a/base-compat/src/System/Environment/Compat/Repl.hs b/base-compat/src/System/Environment/Compat/Repl.hs index bbe6506..47ba2ea 100644 --- a/base-compat/src/System/Environment/Compat/Repl.hs +++ b/base-compat/src/System/Environment/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.Environment.Compat" -- from a globally unique namespace. module System.Environment.Compat.Repl ( diff --git a/base-compat/src/System/Exit/Compat.hs b/base-compat/src/System/Exit/Compat.hs index 75df19d..3784255 100644 --- a/base-compat/src/System/Exit/Compat.hs +++ b/base-compat/src/System/Exit/Compat.hs @@ -1,20 +1,7 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} -{-# LANGUAGE CPP #-} +{-# LANGUAGE NoImplicitPrelude #-} module System.Exit.Compat ( module Base , die ) where import System.Exit as Base - -#if !(MIN_VERSION_base(4,8,0)) - -import Prelude.Compat -import System.IO - --- | Write given error message to `stderr` and terminate with `exitFailure`. --- --- @since 4.8.0.0 -die :: String -> IO a -die err = hPutStrLn stderr err >> exitFailure -#endif diff --git a/base-compat/src/System/Exit/Compat/Repl.hs b/base-compat/src/System/Exit/Compat/Repl.hs index 3c32a72..1211d60 100644 --- a/base-compat/src/System/Exit/Compat/Repl.hs +++ b/base-compat/src/System/Exit/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.Exit.Compat" -- from a globally unique namespace. module System.Exit.Compat.Repl ( diff --git a/base-compat/src/System/IO/Compat/Repl.hs b/base-compat/src/System/IO/Compat/Repl.hs index 939125b..1536ef3 100644 --- a/base-compat/src/System/IO/Compat/Repl.hs +++ b/base-compat/src/System/IO/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Compat" -- from a globally unique namespace. module System.IO.Compat.Repl ( diff --git a/base-compat/src/System/IO/Error/Compat/Repl.hs b/base-compat/src/System/IO/Error/Compat/Repl.hs index 263d8b2..4854389 100644 --- a/base-compat/src/System/IO/Error/Compat/Repl.hs +++ b/base-compat/src/System/IO/Error/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Error.Compat" -- from a globally unique namespace. module System.IO.Error.Compat.Repl ( diff --git a/base-compat/src/System/IO/Unsafe/Compat.hs b/base-compat/src/System/IO/Unsafe/Compat.hs index 7e438f9..e1731fa 100644 --- a/base-compat/src/System/IO/Unsafe/Compat.hs +++ b/base-compat/src/System/IO/Unsafe/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module System.IO.Unsafe.Compat ( module Base , unsafeFixIO @@ -6,30 +6,3 @@ module System.IO.Unsafe.Compat ( ) where import System.IO.Unsafe as Base - -#if !(MIN_VERSION_base(4,5,0)) -import Control.Exception -import Data.IORef -import GHC.Base -import GHC.IO - --- | A slightly faster version of `System.IO.fixIO` that may not be --- safe to use with multiple threads. The unsafety arises when used --- like this: --- --- > unsafeFixIO $ \r -> do --- > forkIO (print r) --- > return (...) --- --- In this case, the child thread will receive a @NonTermination@ --- exception instead of waiting for the value of @r@ to be computed. --- --- /Since: 4.5.0.0/ -unsafeFixIO :: (a -> IO a) -> IO a -unsafeFixIO k = do - ref <- newIORef (throw NonTermination) - ans <- unsafeDupableInterleaveIO (readIORef ref) - result <- k ans - writeIORef ref result - return result -#endif diff --git a/base-compat/src/System/IO/Unsafe/Compat/Repl.hs b/base-compat/src/System/IO/Unsafe/Compat/Repl.hs index e618a72..37d9c7a 100644 --- a/base-compat/src/System/IO/Unsafe/Compat/Repl.hs +++ b/base-compat/src/System/IO/Unsafe/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "System.IO.Unsafe.Compat" -- from a globally unique namespace. module System.IO.Unsafe.Compat.Repl ( diff --git a/base-compat/src/Text/Read/Compat.hs b/base-compat/src/Text/Read/Compat.hs index 880a6a0..48df5a6 100644 --- a/base-compat/src/Text/Read/Compat.hs +++ b/base-compat/src/Text/Read/Compat.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE NoImplicitPrelude #-} module Text.Read.Compat ( -- * The 'Read' class Read(..), @@ -25,34 +25,3 @@ module Text.Read.Compat ( import Text.Read import Text.ParserCombinators.ReadPrec import qualified Text.Read.Lex as L - -#if !(MIN_VERSION_base(4,6,0)) -import Prelude.Compat -import qualified Text.ParserCombinators.ReadP as P - --- | Parse a string using the 'Read' instance. --- Succeeds if there is exactly one valid result. --- A 'Left' value indicates a parse error. --- --- /Since: 4.6.0.0/ -readEither :: Read a => String -> Either String a -readEither s = - case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of - [x] -> Right x - [] -> Left "Prelude.read: no parse" - _ -> Left "Prelude.read: ambiguous parse" - where - read' = - do x <- readPrec - lift P.skipSpaces - return x - --- | Parse a string using the 'Read' instance. --- Succeeds if there is exactly one valid result. --- --- /Since: 4.6.0.0/ -readMaybe :: Read a => String -> Maybe a -readMaybe s = case readEither s of - Left _ -> Nothing - Right a -> Just a -#endif diff --git a/base-compat/src/Text/Read/Compat/Repl.hs b/base-compat/src/Text/Read/Compat/Repl.hs index cec8e25..c1050e8 100644 --- a/base-compat/src/Text/Read/Compat/Repl.hs +++ b/base-compat/src/Text/Read/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Text.Read.Compat" -- from a globally unique namespace. module Text.Read.Compat.Repl ( diff --git a/base-compat/src/Text/Read/Lex/Compat.hs b/base-compat/src/Text/Read/Lex/Compat.hs index efa63e9..b48a65b 100644 --- a/base-compat/src/Text/Read/Lex/Compat.hs +++ b/base-compat/src/Text/Read/Lex/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif module Text.Read.Lex.Compat ( module Base , readBinP diff --git a/base-compat/src/Text/Read/Lex/Compat/Repl.hs b/base-compat/src/Text/Read/Lex/Compat/Repl.hs index 1e724c0..1988ee3 100644 --- a/base-compat/src/Text/Read/Lex/Compat/Repl.hs +++ b/base-compat/src/Text/Read/Lex/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Text.Read.Lex.Compat" -- from a globally unique namespace. module Text.Read.Lex.Compat.Repl ( diff --git a/base-compat/src/Type/Reflection/Compat.hs b/base-compat/src/Type/Reflection/Compat.hs index b1503b4..33716c0 100644 --- a/base-compat/src/Type/Reflection/Compat.hs +++ b/base-compat/src/Type/Reflection/Compat.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP, NoImplicitPrelude #-} -#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} -#endif #if MIN_VERSION_base(4,10,0) {-# LANGUAGE GADTs #-} {-# LANGUAGE PatternSynonyms #-} diff --git a/base-compat/src/Type/Reflection/Compat/Repl.hs b/base-compat/src/Type/Reflection/Compat/Repl.hs index 8004c93..04ace6b 100644 --- a/base-compat/src/Type/Reflection/Compat/Repl.hs +++ b/base-compat/src/Type/Reflection/Compat/Repl.hs @@ -1,5 +1,5 @@ {-# LANGUAGE PackageImports #-} -{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} +{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-} -- | Reexports "Type.Reflection.Compat" -- from a globally unique namespace. module Type.Reflection.Compat.Repl ( diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 27164c8..104cb80 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,18 +1,4 @@ --- Old versions of Haddock have trouble with base-compat-batteries: --- --- * GHC 7.0's Haddock fails to parse test/Prelude/CompatSpec.hs, claiming --- that there is an "Empty 'do' construct". I have no idea why. --- --- * GHC 7.2 runs into "synifyType: PredTys are not, in themselves, source-level --- types" when building the documentation for base-compat-batteries' --- Data.Type.Equality.Compat module. This bug is apparently so obscure that no --- issue was ever filed about it! --- --- * GHC 7.4, 7.8, 7.10, and 8.0 fail to parse test/Prelude.CompatSpec.hs with --- "parse error on input `('". I have no idea why. --- --- * GHC 7.6 runs into https://github.com/haskell/haddock/issues/242 when --- building the documentation for base-compat-batteries' --- Data.Type.Equality.Compat module. +-- GHC 8.0's version of Haddock fails to parse test/Prelude.CompatSpec.hs with +-- "parse error on input `('". I have no idea why. haddock: >=8.2 github-patches: github.yml.patch diff --git a/check/lib/Util.hs b/check/lib/Util.hs index 4c56e34..bc4ad8f 100644 --- a/check/lib/Util.hs +++ b/check/lib/Util.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} module Util (inCabalNewRepl, normalizeLines, normalizeSignatures) where import Data.Char (isAlphaNum, isDigit, isUpper) @@ -26,10 +25,6 @@ inCabalNewRepl module_ input_ = do [ "new-repl" , "for-repl" , "--ghc-options=\"-ignore-dot-ghci -package-env=-\"" -#if __GLASGOW_HASKELL__ == 710 - -- https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/123 - , "--ghc-option=-optl-no-pie" -#endif , "--enable-tests" , "--enable-benchmarks" ] ++ withCompiler ++ diff --git a/check/test/TypeCheck.hs b/check/test/TypeCheck.hs index 7d0a14b..536f7f3 100644 --- a/check/test/TypeCheck.hs +++ b/check/test/TypeCheck.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} module Main (main) where import Control.Monad (unless) @@ -27,16 +26,7 @@ modules = do contents <- getDirectoryContents "index" let noNavigation = contents \\ [".", ".."] noFileExts = map dropExtension noNavigation - noExcluded = noFileExts \\ excluded - return noExcluded - where - excluded :: [FilePath] - excluded = [ -#if !(MIN_VERSION_base(4,4,0)) - "Data.Complex.Compat" - , "Data.Ratio.Compat" -#endif - ] + return noFileExts typeCheck :: FilePath -> String -> Spec typeCheck pwd module_ = diff --git a/check/type-check.cabal b/check/type-check.cabal index 4c97a87..c401bd2 100644 --- a/check/type-check.cabal +++ b/check/type-check.cabal @@ -22,13 +22,7 @@ category: Compatibility license: BSD-3-Clause license-file: LICENSE build-type: Simple -tested-with: GHC == 7.0.4 - , GHC == 7.2.2 - , GHC == 7.4.2 - , GHC == 7.6.3 - , GHC == 7.8.4 - , GHC == 7.10.3 - , GHC == 8.0.2 +tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 @@ -37,7 +31,7 @@ tested-with: GHC == 7.0.4 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 - , GHC == 9.6.5 + , GHC == 9.6.6 , GHC == 9.8.2 , GHC == 9.10.1 @@ -56,7 +50,7 @@ library hs-source-dirs: . build-depends: - base >= 4.3 && < 5 + base >= 4.9 && < 5 , process , parsec >=3.1.11 && <3.2 @@ -67,7 +61,7 @@ executable for-repl main-is: for-repl.hs build-depends: - base, + base >= 4.9 && < 5, base-compat-batteries if impl(ghc >= 9.10) -- This depends on `ghc-internal` to ensure that GHCi prints things like @@ -85,7 +79,7 @@ executable dumptypes hs-source-dirs: exes main-is: dumptypes.hs build-depends: - base, + base >= 4.9 && < 5, type-check -- Run with @@ -96,7 +90,7 @@ executable dumpindex hs-source-dirs: exes main-is: dumpindex.hs build-depends: - base, + base >= 4.9 && < 5, type-check test-suite type-check-test @@ -106,7 +100,7 @@ test-suite type-check-test hs-source-dirs: test main-is: TypeCheck.hs build-depends: - base >= 4.3 && < 5 + base >= 4.9 && < 5 , type-check , directory , filepath diff --git a/mk-repl-modules/MkReplModules.hs b/mk-repl-modules/MkReplModules.hs index f94255f..31efb4a 100644 --- a/mk-repl-modules/MkReplModules.hs +++ b/mk-repl-modules/MkReplModules.hs @@ -44,7 +44,7 @@ mkReplModules dir suffixes = do fileTemplate :: String -> [String] -> String fileTemplate modName suffixes = unlines [ "{-# LANGUAGE PackageImports #-}" - , "{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-}" + , "{-# OPTIONS_GHC -Wno-dodgy-exports -Wno-unused-imports #-}" , "-- | Reexports \"" ++ modName ++ "\"" , "-- from a globally unique namespace." , "module " ++ modName ++ "." ++ List.intercalate "." suffixes ++ " ("