Skip to content

Commit

Permalink
Require building with GHC 8.10 (#431)
Browse files Browse the repository at this point in the history
This is in preparation for some changes that require 8.10 as the
minimum GHC version. See #385.

Some knock-on changes include:

* Unsurprisingly, GHC 8.10 slightly changes the way `-ddump-splices`
  output is pretty-printed, so some test cases' expected output have
  been updated accordingly.

* Now that we only build against GHC 8.10, we can get rid of some CPP
  only needed for older GHCs.

* GHC 8.10 now warns about unqualified `Data.List` imports, so some
  minor tweaks are needed to avoid these warnings.
  • Loading branch information
RyanGlScott authored Jan 26, 2020
1 parent ff20a04 commit 94a1054
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 134 deletions.
88 changes: 29 additions & 59 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.9.20191126
# version: 0.9.20200125
#
version: ~> 1.0
language: c
Expand All @@ -30,17 +30,13 @@ before_cache:
jobs:
include:
- 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.0"]}}
os: linux
- 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"]}}
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-head
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-head","cabal-install-head"]}}
os: linux
allow_failures:
- compiler: ghc-head
- compiler: ghc-8.10.1
before_install:
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
- WITHCOMPILER="-w $HC"
Expand All @@ -53,58 +49,29 @@ 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
- HEADHACKAGE=true
- 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
Expand All @@ -116,6 +83,9 @@ install:
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 @@ -140,14 +110,14 @@ install:
- cat cabal.project || true
- cat cabal.project.local || true
- if [ -f "./configure.ac" ]; then (cd "." && 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 ${TEST} ${BENCH} --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 @@ -173,13 +143,13 @@ script:
- cat cabal.project.local || true
# 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_singletons} && ${CABAL} -vnormal check)
# haddock...
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all

# REGENDATA ("0.9.20191126",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])
# REGENDATA ("0.9.20200125",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])
# EOF
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ knowledge of dependent types.
Compatibility
-------------

The singletons library requires GHC 8.8.1 or greater. Any code that uses the
The singletons library requires GHC 8.10.1 or greater. Any code that uses the
singleton generation primitives needs to enable a long list of GHC
extensions. This list includes, but is not necessarily limited to, the
following:
Expand Down
5 changes: 5 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ raw-project
package th-desugar
tests: False
benchmarks: False

-- Temporarily patch .travis.yml to require the GHC 8.10.1 build
-- to succeed (as 8.10.1 is still pre-release, so haskell-ci allows
-- it to fail by default)
travis-patches: travis.yml.patch
11 changes: 5 additions & 6 deletions singletons.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ author: Richard Eisenberg <[email protected]>, Jan Stolarek <jan.stola
maintainer: Ryan Scott <[email protected]>
bug-reports: https://github.com/goldfirere/singletons/issues
stability: experimental
tested-with: GHC == 8.8.1
, GHC == 8.10.1
tested-with: GHC == 8.10.1
extra-source-files: README.md, CHANGES.md, tests/README.md,
tests/compile-and-dump/GradingClient/*.hs,
tests/compile-and-dump/InsertionSort/*.hs,
Expand Down Expand Up @@ -47,14 +46,14 @@ source-repository head

custom-setup
setup-depends:
base >= 4.13 && < 4.15,
Cabal >= 2.5 && < 3.3,
base >= 4.14 && < 4.15,
Cabal >= 3.2 && < 3.3,
directory >= 1,
filepath >= 1.3

library
hs-source-dirs: src
build-depends: base >= 4.13 && < 4.15,
build-depends: base >= 4.14 && < 4.15,
mtl >= 2.2.1,
ghc-boot-th,
template-haskell,
Expand Down Expand Up @@ -155,7 +154,7 @@ test-suite singletons-test-suite
ByHand2
SingletonsTestSuiteUtils

build-depends: base >= 4.13 && < 4.15,
build-depends: base >= 4.14 && < 4.15,
bytestring >= 0.10.9,
deepseq >= 1.4.4,
filepath >= 1.3,
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Singletons/Deriving/Infer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Language.Haskell.TH.Desugar
import Language.Haskell.TH.Syntax
import Data.Singletons.Deriving.Util
import Data.Singletons.Util
import Data.List
import Data.List (nub)

-- @inferConstraints cls inst_ty cons@ infers the instance context for a
-- derived type class instance of @cls@ for @inst_ty@, using the constructors
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Singletons/Deriving/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
module Data.Singletons.Deriving.Util where

import Control.Monad
import Data.List
import qualified Data.List as List
import Data.Singletons.Names
import Data.Singletons.Syntax
import Data.Singletons.Util
Expand Down Expand Up @@ -213,7 +213,7 @@ functorLikeValidityChecks allowConstrainedLastTyVar (DataDecl n data_tvbs cons)
, (_, last_res_ty_arg) <- snocView $ filterDTANormals res_ty_args
, Just last_tv <- getDVarTName_maybe last_res_ty_arg
= do ex_tvbs <- conExistentialTvbs (foldTypeTvbs (DConT n) data_tvbs) con
let univ_tvb_names = map extractTvbName con_tvbs \\ map extractTvbName ex_tvbs
let univ_tvb_names = map extractTvbName con_tvbs List.\\ map extractTvbName ex_tvbs
if last_tv `elem` univ_tvb_names
&& last_tv `OSet.notMember` foldMap fvDType con_theta
then pure ()
Expand Down
3 changes: 2 additions & 1 deletion src/Data/Singletons/Prelude/List/Internal/Disambiguation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import Data.Singletons.Prelude.List.Internal
import Data.Singletons.Prelude.Num
import Data.Singletons.Prelude.Ord
import Data.Singletons.Prelude.Eq
import Data.List
import Data.List ( foldl', inits, insert, intersperse, isPrefixOf
, nubBy, partition, sort, sortBy, tails, transpose )
import GHC.TypeLits

-- singletons doesn't support qualified names :(
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Singletons/Single.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Data.Maybe
import qualified Data.Set as Set
import Control.Monad
import Control.Monad.Trans.Class
import Data.List
import Data.List (unzip6, zipWith4)
import qualified GHC.LanguageExtensions.Type as LangExt

{-
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Singletons/Single/Defun.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
module Data.Singletons.Single.Defun (singDefuns) where

import Control.Monad
import Data.List
import Data.Foldable
import Data.Singletons.Names
import Data.Singletons.Promote.Defun
import Data.Singletons.Single.Monad
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Singletons/Single/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file defines the SgM monad and its operations, for use during singling.
The SgM monad allows reading from a SgEnv environment and is wrapped around a Q.
-}

{-# LANGUAGE GeneralizedNewtypeDeriving, ParallelListComp, TemplateHaskell, CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving, ParallelListComp, TemplateHaskell #-}

module Data.Singletons.Single.Monad (
SgM, bindLets, bindContext, askContext, lookupVarE, lookupConE,
Expand Down Expand Up @@ -78,9 +78,7 @@ instance Quasi SgM where
qAddForeignFilePath = liftSgM `comp2` qAddForeignFilePath
qAddTempFile = liftSgM `comp1` qAddTempFile
qAddCorePlugin = liftSgM `comp1` qAddCorePlugin
#if MIN_VERSION_template_haskell(2,16,0)
qReifyType = liftSgM `comp1` qReifyType
#endif

qRecover (SgM handler) (SgM body) = do
env <- ask
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Singletons/Single/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Data.Singletons.Util
import Control.Monad
import Data.Foldable
import Data.Function
import Data.List
import Data.List (deleteFirstsBy)

singType :: OSet Name -- the set of bound kind variables in this scope
-- see Note [Explicitly binding kind variables]
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Singletons/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Users of the package should not need to consult this file.
TemplateHaskell, GeneralizedNewtypeDeriving,
MultiParamTypeClasses, UndecidableInstances, MagicHash,
LambdaCase, NoMonomorphismRestriction, ScopedTypeVariables,
FlexibleContexts, CPP #-}
FlexibleContexts #-}

module Data.Singletons.Util where

Expand Down Expand Up @@ -497,9 +497,7 @@ instance (Quasi q, Monoid m) => Quasi (QWithAux m q) where
qAddForeignFilePath = lift `comp2` qAddForeignFilePath
qAddTempFile = lift `comp1` qAddTempFile
qAddCorePlugin = lift `comp1` qAddCorePlugin
#if MIN_VERSION_template_haskell(2,16,0)
qReifyType = lift `comp1` qReifyType
#endif

qRecover exp handler = do
(result, aux) <- lift $ qRecover (evalForPair exp) (evalForPair handler)
Expand Down
Loading

0 comments on commit 94a1054

Please sign in to comment.