Skip to content

Commit

Permalink
Drop GHC < 8.6.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed May 1, 2024
1 parent 9c4c133 commit a61b16b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 157 deletions.
111 changes: 34 additions & 77 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.20240501
#
# REGENDATA ("0.17.20231010",["github","cabal.project"])
# REGENDATA ("0.19.20240501",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -27,24 +27,24 @@ 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.8.2
compilerKind: ghc
compilerVersion: 9.8.1
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.3
- compiler: ghc-9.6.5
compilerKind: ghc
compilerVersion: 9.6.3
compilerVersion: 9.6.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.7
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.7
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
Expand All @@ -65,59 +65,25 @@ jobs:
- compiler: ghc-8.8.3
compilerKind: ghc
compilerVersion: 8.8.3
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
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" 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)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -129,22 +95,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 @@ -201,7 +158,7 @@ jobs:
chmod a+x $HOME/.cabal/bin/cabal-plan
cabal-plan --version
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: source
- name: initial cabal.project for sdist
Expand All @@ -225,8 +182,8 @@ jobs:
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_text_short}" >> cabal.project
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package text-short" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "package text-short" >> 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 /^(text-short)$/; }' >> cabal.project.local
Expand All @@ -237,7 +194,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 @@ -271,11 +228,11 @@ jobs:
rm -f cabal.project.local
- name: constraint set text-2
run: |
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all --dry-run ; fi
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90800)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all ; fi
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all --dry-run ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=2' all ; fi
- name: constraint set text-1
run: |
if [ $((HCNUMVER < 90400)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>=1.2.3.0' all --dry-run ; fi
Expand All @@ -291,7 +248,7 @@ jobs:
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ==0.11.*' all ; fi
if [ $((HCNUMVER < 90800)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ==0.11.*' all ; fi
- 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
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.6

* Drop support for GHC prior 8.6.5
* Support GHC-9.10 (base-4.21)

## 0.1.5

* text-2.0 support
Expand Down
23 changes: 0 additions & 23 deletions src-ghc708/PrimOps.hs

This file was deleted.

18 changes: 1 addition & 17 deletions src/Data/Text/Short/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedFFITypes #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE ViewPatterns #-}

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

-- |
-- Module : Data.Text.Short.Internal
-- Copyright : © Herbert Valerio Riedel 2017
Expand Down Expand Up @@ -238,24 +233,13 @@ instance PrintfArg ShortText where
formatArg txt = formatString $ toString txt

-- | The 'Binary' encoding matches the one for 'T.Text'
#if MIN_VERSION_binary(0,8,1)
instance Binary ShortText where
put = put . toShortByteString
get = do
sbs <- get
case fromShortByteString sbs of
Nothing -> fail "Binary.get(ShortText): Invalid UTF-8 stream"
Just st -> return st
#else
-- fallback via 'ByteString' instance
instance Binary ShortText where
put = put . toByteString
get = do
bs <- get
case fromByteString bs of
Nothing -> fail "Binary.get(ShortText): Invalid UTF-8 stream"
Just st -> return st
#endif

-- | Since 0.1.3
instance TH.Lift ShortText where
Expand Down
56 changes: 16 additions & 40 deletions text-short.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.18
name: text-short
version: 0.1.5.1
version: 0.1.6
synopsis: Memory-efficient representation of Unicode text strings
license: BSD3
license-file: LICENSE
Expand All @@ -15,19 +15,14 @@ description:
The main difference between 'Text' and 'ShortText' is that 'ShortText' doesn't support zero-copy slicing (thereby saving 2 words), and, compared to text-1.*, that it uses UTF-8 instead of UTF-16 internally. Consequently, the memory footprint of a (boxed) 'ShortText' value is 4 words (2 words when unboxed) plus the length of the UTF-8 encoded payload.

tested-with:
GHC ==7.8.4
|| ==7.10.3
|| ==8.0.2
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
GHC ==8.6.5
|| ==8.8.3
|| ==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

extra-source-files: ChangeLog.md

Expand All @@ -48,46 +43,27 @@ library

other-modules: Data.Text.Short.Internal
build-depends:
base >=4.7 && <4.20
, binary >=0.7.1 && <0.9
, bytestring >=0.10.4 && <0.13
, deepseq >=1.3 && <1.6
, ghc-prim >=0.3.1 && <0.12
, hashable >=1.2.6 && <1.5
, template-haskell >=2.9.0.0 && <2.22
, text >=1.0 && <1.3 || >=2.0 && <2.2

if impl(ghc >=8.0)
build-depends: bytestring >=0.10.8.0

if !impl(ghc >=8.0)
build-depends: semigroups >=0.18.2 && <0.21

-- GHC version specific PrimOps
if impl(ghc >=8.4)
hs-source-dirs: src-ghc804

else
c-sources: cbits/memcmp.c
hs-source-dirs: src-ghc708
base >=4.12 && <4.20
, binary >=0.8.6.0 && <0.9
, bytestring >=0.10.8.2 && <0.13
, deepseq >=1.4.4.0 && <1.6
, ghc-prim >=0.5.3 && <0.12
, hashable >=1.4.4.0 && <1.5
, template-haskell >=2.14.0.0 && <2.22
, text >=1.2.3.1 && <1.3 || >=2.0 && <2.2

other-modules: PrimOps
hs-source-dirs: src
hs-source-dirs: src src-ghc804
default-language: Haskell2010
other-extensions:
CPP
GeneralizedNewtypeDeriving
MagicHash
TemplateHaskellQuotes
Trustworthy
UnliftedFFITypes
Unsafe

if impl(ghc >=8)
other-extensions: TemplateHaskellQuotes

else
other-extensions: TemplateHaskell

c-sources: cbits/cbits.c

if flag(asserts)
Expand All @@ -99,7 +75,7 @@ library
ghc-options: -Wall
cc-options: -Wall

test-suite tests
test-suite text-short-tests
type: exitcode-stdio-1.0
hs-source-dirs: src-test
main-is: Tests.hs
Expand Down

0 comments on commit a61b16b

Please sign in to comment.