Skip to content

Commit

Permalink
Merge pull request #99 from basvandijk/noble
Browse files Browse the repository at this point in the history
Support GHC-8.6.5...GHC-9.10.1
  • Loading branch information
phadej authored May 14, 2024
2 parents 5badac1 + e9752bf commit ae80d60
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 182 deletions.
114 changes: 35 additions & 79 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.17.20231010
# version: 0.19.20240513
#
# REGENDATA ("0.17.20231010",["github","cabal.project"])
# REGENDATA ("0.19.20240513",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -29,24 +29,29 @@ 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.8.1
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.8.1
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.3
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.6.3
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.7
- compiler: ghc-9.6.5
compilerKind: ghc
compilerVersion: 9.4.7
compilerVersion: 9.6.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
Expand All @@ -67,64 +72,24 @@ 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
allow-failure: false
- compiler: ghc-8.4.4
compilerKind: ghc
compilerVersion: 8.4.4
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-8.2.2
compilerKind: ghc
compilerVersion: 8.2.2
setup-method: hvr-ppa
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
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.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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.10.1.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.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
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" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -136,22 +101,13 @@ 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.1.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.1.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.10.2.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"
Expand Down Expand Up @@ -210,14 +166,14 @@ jobs:
- name: install cabal-docspec
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230517/cabal-docspec-0.0.0.20230517-x86_64-linux.xz > cabal-docspec.xz
echo '3b31bbe463ad4d671abbc103db49628562ec48a6604cab278207b5b6acd21ed7 cabal-docspec.xz' | sha256sum -c -
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20240414/cabal-docspec-0.0.0.20240414-x86_64-linux.xz > cabal-docspec.xz
echo '2d18a3f79619e8ec5f11870f926f6dc2616e02a6c889315b7f82044b95a1adb9 cabal-docspec.xz' | sha256sum -c -
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
rm -f cabal-docspec.xz
chmod a+x $HOME/.cabal/bin/cabal-docspec
cabal-docspec --version
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: source
- name: initial cabal.project for sdist
Expand All @@ -241,8 +197,8 @@ jobs:
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_scientific}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package scientific" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "package scientific" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(scientific)$/; }' >> cabal.project.local
Expand All @@ -253,7 +209,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
Expand Down Expand Up @@ -287,7 +243,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 }}
Expand Down
63 changes: 18 additions & 45 deletions scientific.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: scientific
version: 0.3.7.0
x-revision: 7
version: 0.3.8.0
synopsis: Numbers represented using scientific notation
description:
"Data.Scientific" provides the number type 'Scientific'. Scientific numbers are
Expand Down Expand Up @@ -44,32 +43,20 @@ build-type: Simple
cabal-version: >=1.10
extra-source-files: changelog
tested-with:
GHC ==7.6.3
|| ==7.8.4
|| ==7.10.3
|| ==8.0.2
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.8
|| ==9.4.7
|| ==9.6.3
|| ==9.8.1
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

source-repository head
type: git
location: git://github.com/basvandijk/scientific.git

flag bytestring-builder
description:
Depend on the bytestring-builder package for backwards compatibility.

default: False
manual: False

flag integer-simple
description: Use the integer-simple package instead of integer-gmp
default: False
Expand All @@ -91,23 +78,16 @@ library

ghc-options: -Wall
build-depends:
base >=4.5 && <4.20
, binary >=0.5.1 && <0.9
, containers >=0.4.2.1 && <0.7
, deepseq >=1.3.0.0 && <1.6
, hashable >=1.2.7.0 && <1.5
, integer-logarithms >=1.0.3.1 && <1.1
, primitive >=0.7.1.0 && <0.10
, template-haskell >=2.8 && <2.22
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.2

if flag(bytestring-builder)
build-depends:
bytestring >=0.9 && <0.10.4
, bytestring-builder >=0.10.4 && <0.11

else
build-depends: bytestring >=0.10.4 && <0.13
base >=4.5 && <4.21
, binary >=0.8.6.0 && <0.9
, bytestring >=0.10.8.2 && <0.13
, containers >=0.6.0.1 && <0.8
, deepseq >=1.4.4.0 && <1.6
, hashable >=1.4.4.0 && <1.5
, integer-logarithms >=1.0.3.1 && <1.1
, primitive >=0.9.0.0 && <0.10
, template-haskell >=2.14.0.0 && <2.23
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.2

if impl(ghc >=9.0)
build-depends: base >=4.15
Expand All @@ -125,7 +105,7 @@ library
if impl(ghc <8)
other-extensions: TemplateHaskell

if impl(ghc >= 9.0)
if impl(ghc >=9.0)
-- these flags may abort compilation with GHC-8.10
-- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295
ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode
Expand All @@ -142,6 +122,7 @@ test-suite test-scientific
build-depends:
base
, binary
, bytestring
, QuickCheck >=2.14.2
, scientific
, smallcheck >=1.0
Expand All @@ -151,14 +132,6 @@ test-suite test-scientific
, tasty-smallcheck >=0.2
, text

if flag(bytestring-builder)
build-depends:
bytestring
, bytestring-builder

else
build-depends: bytestring

benchmark bench-scientific
type: exitcode-stdio-1.0
hs-source-dirs: bench
Expand Down
13 changes: 1 addition & 12 deletions src/Data/ByteString/Builder/Scientific.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE CPP, OverloadedStrings, Safe #-}
{-# LANGUAGE OverloadedStrings, Safe #-}

module Data.ByteString.Builder.Scientific
( scientificBuilder
Expand All @@ -17,18 +17,7 @@ import Data.ByteString.Builder.Extra (byteStringCopy)

import Utils (roundTo, i2d)

#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (mempty)
#endif

#if MIN_VERSION_base(4,5,0)
import Data.Monoid ((<>))
#else
import Data.Monoid (Monoid, mappend)
(<>) :: Monoid a => a -> a -> a
(<>) = mappend
infixr 6 <>
#endif


-- | A @ByteString@ @Builder@ which renders a scientific number to full
Expand Down
22 changes: 0 additions & 22 deletions src/Data/Scientific.hs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE Trustworthy #-}

#if __GLASGOW_HASKELL__ >= 800
{-# LANGUAGE DeriveLift #-}
{-# LANGUAGE StandaloneDeriving #-}
#else
{-# LANGUAGE TemplateHaskell #-}
#endif

-- |
-- Module : Data.Scientific
Expand Down Expand Up @@ -125,16 +119,6 @@ import qualified Text.ParserCombinators.ReadP as ReadP
import Text.ParserCombinators.ReadP ( ReadP )
import Data.Text.Lazy.Builder.RealFloat (FPFormat(..))

#if !MIN_VERSION_base(4,9,0)
import Control.Applicative ((*>))
#endif

#if !MIN_VERSION_base(4,8,0)
import Data.Functor ((<$>))
import Data.Word (Word)
import Control.Applicative ((<*>))
#endif

import GHC.Integer.Compat (quotRemInteger, quotInteger, divInteger)
import Utils (maxExpt, roundTo, magnitude)

Expand Down Expand Up @@ -191,14 +175,8 @@ scientific = Scientific
-- Instances
----------------------------------------------------------------------

#if __GLASGOW_HASKELL__ >= 800
-- | @since 0.3.7.0
deriving instance Lift Scientific
#else
instance Lift Scientific where
lift (Scientific c e) = [| Scientific c e |]
#endif


instance NFData Scientific where
rnf (Scientific _ _) = ()
Expand Down
Loading

0 comments on commit ae80d60

Please sign in to comment.