Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport functions introduced in base-4.14 #67

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 49 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.8
# version: 0.9.20200125
#
# This file is patched to install the typediff utility from its repoistory
# (see travis.yml.patch).
Expand Down Expand Up @@ -32,8 +32,11 @@ before_cache:
- rm -rfv $CABALHOME/packages/head.hackage
jobs:
include:
- compiler: ghc-8.8.1
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
- compiler: ghc-8.10.1
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}
os: linux
- compiler: ghc-8.8.2
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.2","cabal-install-3.0"]}}
os: linux
- compiler: ghc-8.6.5
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
Expand Down Expand Up @@ -65,6 +68,8 @@ jobs:
- compiler: ghc-7.0.4
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.0.4","cabal-install-3.0"]}}
os: linux
allow_failures:
- compiler: ghc-8.10.1
before_install:
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- WITHCOMPILER="-w $HC"
Expand All @@ -81,57 +86,43 @@ before_install:
- TOP=$(pwd)
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
- echo $HCNUMVER
- CABAL="$CABAL -vnormal+nowrap+markoutput"
- CABAL="$CABAL -vnormal+nowrap"
- set -o pipefail
- |
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
echo 'BEGIN { state = "output"; }' >> .colorful.awk
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
echo ' if (state == "cabal") {' >> .colorful.awk
echo ' print blue($0)' >> .colorful.awk
echo ' } else {' >> .colorful.awk
echo ' print $0' >> .colorful.awk
echo ' }' >> .colorful.awk
echo '}' >> .colorful.awk
- cat .colorful.awk
- |
color_cabal_output () {
awk -f $TOP/.colorful.awk
}
- echo text | color_cabal_output
install:
- ${CABAL} --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- TEST=--enable-tests
- BENCH=--enable-benchmarks
- HEADHACKAGE=false
- if [ $HCNUMVER -ge 81000 ] ; then HEADHACKAGE=true ; fi
- rm -f $CABALHOME/config
- |
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "write-ghc-environment-files: always" >> $CABALHOME/config
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
echo "install-dirs user" >> $CABALHOME/config
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
echo " secure: True" >> $CABALHOME/config
echo " key-threshold: 3" >> $CABALHOME/config
echo " root-keys:" >> $CABALHOME/config
echo " fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0" >> $CABALHOME/config
echo " 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42" >> $CABALHOME/config
echo " 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3" >> $CABALHOME/config
echo " 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d" >> $CABALHOME/config
echo " 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921" >> $CABALHOME/config
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "write-ghc-environment-files: always" >> $CABALHOME/config
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
echo "install-dirs user" >> $CABALHOME/config
echo " prefix: $CABALHOME" >> $CABALHOME/config
echo "repository hackage.haskell.org" >> $CABALHOME/config
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
- |
if $HEADHACKAGE; then
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config
echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config
echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config
echo " secure: True" >> $CABALHOME/config
echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config
echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config
echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
echo " key-threshold: 3" >> $CABALHOME/config
fi
install:
- ${CABAL} --version
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
- |
echo "program-default-options" >> $CABALHOME/config
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
Expand All @@ -152,15 +143,15 @@ install:
- if [ -f "./base-compat/configure.ac" ]; then (cd "./base-compat" && autoreconf -i); fi
- if [ -f "./base-compat-batteries/configure.ac" ]; then (cd "./base-compat-batteries" && autoreconf -i); fi
- if [ -f "./check/configure.ac" ]; then (cd "./check" && autoreconf -i); fi
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
script:
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- ${CABAL} v2-sdist all | color_cabal_output
- ${CABAL} v2-sdist all
# Unpacking...
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
- cd ${DISTDIR} || false
Expand All @@ -182,21 +173,21 @@ script:
- cat cabal.project.local || true
# Building...
# this builds all libraries and executables (without tests/benchmarks)
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
# Building with tests and benchmarks...
# build & run tests, build benchmarks
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all
# Testing...
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all
# cabal check...
- (cd ${PKGDIR_base_compat} && ${CABAL} -vnormal check)
- (cd ${PKGDIR_base_compat_batteries} && ${CABAL} -vnormal check)
- (cd ${PKGDIR_type_check} && ${CABAL} -vnormal check)
# haddock...
- if [ $HCNUMVER -lt 70200 ] || [ $HCNUMVER -ge 70400 ] && [ $HCNUMVER -lt 70600 ] || [ $HCNUMVER -ge 70800 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output ; fi
- if [ $HCNUMVER -lt 70200 ] || [ $HCNUMVER -ge 70400 ] && [ $HCNUMVER -lt 70600 ] || [ $HCNUMVER -ge 70800 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi
# Building without installed constraints for packages in global-db...
- rm -f cabal.project.local
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all

# REGENDATA ("0.8",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])
# REGENDATA ("0.9.20200125",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])
# EOF
5 changes: 5 additions & 0 deletions base-compat-batteries/CHANGES.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Changes in ?.??.? [????.??.??]
- This coincides with the `base-compat-?.??.?` release. Refer to the
[`base-compat` changelog](https://github.com/haskell-compat/base-compat/blob/master/base-compat/CHANGES.markdown#changes-in-????-????????)
for more details.

## Changes in 0.11.0 [2019.09.06]
- Reexport `MonadFail(fail)` from `Prelude.Compat` and `Control.Monad.Compat`.

Expand Down
5 changes: 4 additions & 1 deletion base-compat-batteries/base-compat-batteries.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ tested-with: GHC == 7.0.4
, GHC == 8.2.2
, GHC == 8.4.4
, GHC == 8.6.5
, GHC == 8.8.1
, GHC == 8.8.2
, GHC == 8.10.1
extra-source-files: CHANGES.markdown, README.markdown

source-repository head
Expand Down Expand Up @@ -141,6 +142,7 @@ library
Prelude.Compat
System.Environment.Compat
System.Exit.Compat
System.IO.Error.Compat
System.IO.Unsafe.Compat
Text.Read.Compat
Type.Reflection.Compat
Expand Down Expand Up @@ -199,6 +201,7 @@ library
Prelude.Compat.Repl.Batteries
System.Environment.Compat.Repl.Batteries
System.Exit.Compat.Repl.Batteries
System.IO.Error.Compat.Repl.Batteries
System.IO.Unsafe.Compat.Repl.Batteries
Text.Read.Compat.Repl.Batteries
Type.Reflection.Compat.Repl.Batteries
Expand Down
6 changes: 6 additions & 0 deletions base-compat-batteries/src/System/IO/Error/Compat.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-}
module System.IO.Error.Compat (
module Base
) where

import "base-compat" System.IO.Error.Compat as Base
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE PackageImports #-}
{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-}
-- | Reexports "System.IO.Error.Compat"
-- from a globally unique namespace.
module System.IO.Error.Compat.Repl.Batteries (
module System.IO.Error.Compat
) where
import "this" System.IO.Error.Compat
1 change: 1 addition & 0 deletions base-compat-batteries/test/SafeHaskellSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import Numeric.Natural.Compat ()
import Prelude.Compat
import System.Environment.Compat ()
import System.Exit.Compat ()
import System.IO.Error ()
import Text.Read.Compat ()
import Type.Reflection.Compat ()

Expand Down
5 changes: 5 additions & 0 deletions base-compat/CHANGES.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Changes in ?.??.? [????.??.??]
- Sync with `base-4.14`/GHC 8.10
- Backport `isResourceVanishedError`, `resourceVanishedErrorType`, and
`isResourceVanishedErrorType` to `System.IO.Error.Compat`.

## Changes in 0.11.0 [2019.09.06]
- Sync with `base-4.13`/GHC 8.8
- Backport `MonadFail(fail)` to `Prelude.Compat` and `Control.Monad.Compat`.
Expand Down
46 changes: 14 additions & 32 deletions base-compat/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ So far the following is covered.
* `unsafeFixIO` and `unsafeDupablePerformIO` to `System.IO.Unsafe.IO`
* `RuntimeRep`-polymorphic `($!)` to `Prelude.Compat`
* `RuntimeRep`-polymorphic `throw` to `Control.Exception.Compat`
* `isResourceVanishedError`, `resourceVanishedErrorType`, and
`isResourceVanishedErrorType` to `System.IO.Error.Compat`

## What is not covered

Expand Down Expand Up @@ -302,38 +304,18 @@ on, paired with the things that each library backports:

## Supported versions of GHC/`base`

* `ghc-8.8.1` / `base-4.13.0.0`
* `ghc-8.6.5` / `base-4.12.0.0`
* `ghc-8.6.4` / `base-4.12.0.0`
* `ghc-8.6.3` / `base-4.12.0.0`
* `ghc-8.6.2` / `base-4.12.0.0`
* `ghc-8.6.1` / `base-4.12.0.0`
* `ghc-8.4.4` / `base-4.11.1.0`
* `ghc-8.4.3` / `base-4.11.1.0`
* `ghc-8.4.2` / `base-4.11.1.0`
* `ghc-8.4.1` / `base-4.11.0.0`
* `ghc-8.2.2` / `base-4.10.1.0`
* `ghc-8.2.1` / `base-4.10.0.0`
* `ghc-8.0.2` / `base-4.9.1.0`
* `ghc-8.0.1` / `base-4.9.0.0`
* `ghc-7.10.3` / `base-4.8.2.0`
* `ghc-7.10.2` / `base-4.8.1.0`
* `ghc-7.10.1` / `base-4.8.0.0`
* `ghc-7.8.4` / `base-4.7.0.2`
* `ghc-7.8.3` / `base-4.7.0.1`
* `ghc-7.8.2` / `base-4.7.0.0`
* `ghc-7.8.1` / `base-4.7.0.0`
* `ghc-7.6.3` / `base-4.6.0.1`
* `ghc-7.6.2` / `base-4.6.0.1`
* `ghc-7.6.1` / `base-4.6.0.0`
* `ghc-7.4.2` / `base-4.5.1.0`
* `ghc-7.4.1` / `base-4.5.0.0`
* `ghc-7.2.2` / `base-4.4.1.0`
* `ghc-7.2.1` / `base-4.4.0.0`
* `ghc-7.0.4` / `base-4.3.1.0`
* `ghc-7.0.3` / `base-4.3.1.0`
* `ghc-7.0.2` / `base-4.3.1.0`
* `ghc-7.0.1` / `base-4.3.0.0`
* `ghc-8.10.*` / `base-4.14.*`
* `ghc-8.8.*` / `base-4.13.*`
* `ghc-8.6.*` / `base-4.12.*`
* `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,
Expand Down
5 changes: 4 additions & 1 deletion base-compat/base-compat.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ tested-with: GHC == 7.0.4
, GHC == 8.2.2
, GHC == 8.4.4
, GHC == 8.6.5
, GHC == 8.8.1
, GHC == 8.8.2
, GHC == 8.10.1
extra-source-files: CHANGES.markdown, README.markdown

source-repository head
Expand Down Expand Up @@ -131,6 +132,7 @@ library
Prelude.Compat
System.Environment.Compat
System.Exit.Compat
System.IO.Error.Compat
System.IO.Unsafe.Compat
Text.Read.Compat
Type.Reflection.Compat
Expand Down Expand Up @@ -189,6 +191,7 @@ library
Prelude.Compat.Repl
System.Environment.Compat.Repl
System.Exit.Compat.Repl
System.IO.Error.Compat.Repl
System.IO.Unsafe.Compat.Repl
Text.Read.Compat.Repl
Type.Reflection.Compat.Repl
37 changes: 37 additions & 0 deletions base-compat/src/System/IO/Error/Compat.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{-# LANGUAGE CPP, NoImplicitPrelude #-}
module System.IO.Error.Compat (
module Base
, isResourceVanishedError
, resourceVanishedErrorType
, isResourceVanishedErrorType
) where

import System.IO.Error as Base

#if !(MIN_VERSION_base(4,14,0))
import GHC.IO.Exception (IOErrorType(..))
import Prelude.Compat

-- | An error indicating that the operation failed because the
-- resource vanished. See 'resourceVanishedErrorType'.
--
-- /Since 4.14.0.0/
isResourceVanishedError :: IOError -> Bool
isResourceVanishedError = isResourceVanishedErrorType . ioeGetErrorType

-- | I\/O error where the operation failed because the resource vanished.
-- This happens when, for example, attempting to write to a closed
-- socket or attempting to write to a named pipe that was deleted.
--
-- /Since 4.14.0.0/
resourceVanishedErrorType :: IOErrorType
resourceVanishedErrorType = ResourceVanished

-- | I\/O error where the operation failed because the resource vanished.
-- See 'resourceVanishedErrorType'.
--
-- /Since 4.14.0.0/
isResourceVanishedErrorType :: IOErrorType -> Bool
isResourceVanishedErrorType ResourceVanished = True
isResourceVanishedErrorType _ = False
#endif
8 changes: 8 additions & 0 deletions base-compat/src/System/IO/Error/Compat/Repl.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE PackageImports #-}
{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-}
-- | Reexports "System.IO.Error.Compat"
-- from a globally unique namespace.
module System.IO.Error.Compat.Repl (
module System.IO.Error.Compat
) where
import "this" System.IO.Error.Compat
3 changes: 2 additions & 1 deletion check/type-check.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ tested-with: GHC == 7.0.4
, GHC == 8.2.2
, GHC == 8.4.4
, GHC == 8.6.5
, GHC == 8.8.1
, GHC == 8.8.2
, GHC == 8.10.1
library
exposed-modules:
TypeDump
Expand Down