Skip to content

Commit

Permalink
Merge pull request #25 from phadej/ghc-9.8
Browse files Browse the repository at this point in the history
GHC-9.8 support
  • Loading branch information
phadej authored Oct 31, 2023
2 parents 5173ca9 + dd78e29 commit 9c9b0a8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 72 deletions.
41 changes: 26 additions & 15 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.16
# version: 0.17.20231010
#
# REGENDATA ("0.16",["github","cabal.project"])
# REGENDATA ("0.17.20231010",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -32,19 +32,24 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.6.1
- compiler: ghc-9.8.1
compilerKind: ghc
compilerVersion: 9.6.1
compilerVersion: 9.8.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.4
- compiler: ghc-9.6.3
compilerKind: ghc
compilerVersion: 9.4.4
compilerVersion: 9.6.3
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.7
- compiler: ghc-9.4.7
compilerKind: ghc
compilerVersion: 9.2.7
compilerVersion: 9.4.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
Expand Down Expand Up @@ -120,7 +125,7 @@ jobs:
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.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
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)
Expand All @@ -129,7 +134,7 @@ jobs:
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
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
Expand All @@ -145,10 +150,12 @@ jobs:
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
if [ "${{ matrix.setup-method }}" = ghcup ]; then
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
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=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$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
Expand Down Expand Up @@ -216,8 +223,8 @@ 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.20230406/cabal-docspec-0.0.0.20230406-x86_64-linux.xz > cabal-docspec.xz
echo '68fa9addd5dc453d533a74a763950499d4593b1297c9a05c3ea5bd1acc04c9dd cabal-docspec.xz' | sha256sum -c -
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 -
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
rm -f cabal-docspec.xz
chmod a+x $HOME/.cabal/bin/cabal-docspec
Expand Down Expand Up @@ -298,10 +305,14 @@ jobs:
rm -f cabal.project.local
- name: constraint set intersection
run: |
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' all --dry-run
cabal-plan topo | sort
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' --dependencies-only -j2 all
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' all
- name: constraint set no-cfg
run: |
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' all --dry-run ; fi
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' all ; fi
- name: save cache
Expand Down
48 changes: 7 additions & 41 deletions bench/JSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ module Main (main, jsonRE, jsonRE', jsonNames, jsonCFG, jsonDerp, derp) where
import Prelude hiding (exponent)

import Criterion.Main (bench, defaultMain, whnf)
import Data.Either (isRight)
import Data.Maybe (isJust)
import System.Clock (Clock (Monotonic), diffTimeSpec, getTime)

import qualified Data.Aeson.Parser as A
import qualified Data.Attoparsec.ByteString as Atto
import qualified Data.ByteString as BS
import qualified Data.Set as Set
import qualified Text.Derp as D

#ifdef MIN_VERSION_saison
import qualified Saison.Decoding.Parser as S
import qualified Saison.Decoding.Tokens as S
#endif
import qualified Data.Aeson as A
import qualified Data.ByteString as BS
import qualified Data.Set as Set
import qualified Text.Derp as D

import RERE
import RERE.Examples.JSON
Expand All @@ -34,32 +28,7 @@ derp :: D.Parser Char () -> String -> Bool
derp p s = not $ Set.null $ D.runParse p [ D.Token c [c] | c <- s]

aeson :: BS.ByteString -> Bool
aeson bs = isRight (Atto.parseOnly (A.json <* Atto.endOfInput) bs)

#ifdef MIN_VERSION_saison
saison :: BS.ByteString -> Bool
saison = go end . S.tokens where
end :: BS.ByteString -> Bool
end = BS.null . S.skipSpace

go :: (k -> Bool) -> S.Tokens k e -> Bool
go kont (S.TkLit _ k) = kont k
go kont (S.TkText _ k) = kont k
go kont (S.TkNumber _ k) = kont k
go kont (S.TkArrayOpen arr) = goArr kont arr
go kont (S.TkRecordOpen obj) = goObj kont obj
go _ (S.TkErr _) = False

goArr :: (k -> Bool) -> S.TkArray k e -> Bool
goArr kont (S.TkItem k) = go (goArr kont) k
goArr kont (S.TkArrayEnd k) = kont k
goArr _ (S.TkArrayErr _) = False

goObj :: (k -> Bool) -> S.TkRecord k e -> Bool
goObj kont (S.TkPair _ k) = go (goObj kont) k
goObj kont (S.TkRecordEnd k) = kont k
goObj _ (S.TkRecordErr _) = False
#endif
aeson bs = isJust (A.decodeStrict bs :: Maybe A.Value)

main :: IO ()
main = do
Expand Down Expand Up @@ -90,10 +59,7 @@ main = do
putStrLn "Criterion"
defaultMain
[ bench "aeson" $ whnf aeson bs
#ifdef MIN_VERSION_saison
, bench "saison" $ whnf saison bs
#endif
-- , bench "rere" $ whnf (matchR jsonRE) contents
, bench "rere" $ whnf (matchST jsonRE) contents
]

-------------------------------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ benchmarks: True

constraints: rere +rere-intersection

-- allow-newer: async-2.2.2:base
-- allow-newer: dec-0.0.3:base
-- allow-newer: fin-0.1.1:base
-- allow-newer: hashable-1.3.0.0:base
-- allow-newer: vec-0.3:base

package rere
-- ghc-options: -Wall -Werror
19 changes: 9 additions & 10 deletions rere.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cabal-version: 2.2
name: rere
version: 0.2
x-revision: 3
version: 0.2.0.1
synopsis:
Regular-expressions extended with fixpoints for context-free powers

Expand Down Expand Up @@ -33,9 +32,10 @@ tested-with:
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.7
|| ==9.4.4
|| ==9.6.1
|| ==9.2.8
|| ==9.4.7
|| ==9.6.3
|| ==9.8.1

source-repository head
type: git
Expand All @@ -61,7 +61,7 @@ library

-- GHC boot libraries
build-depends:
, base >=4.3.0.0 && <4.19
, base >=4.3.0.0 && <4.20
, containers ^>=0.4.0.0 || ^>=0.5.0.0 || ^>=0.6.0.1
, parsec ^>=3.1.12.0
, transformers ^>=0.3.0.0 || ^>=0.4.2.0 || ^>=0.5.2.0 || ^>=0.6.1.0
Expand Down Expand Up @@ -146,8 +146,7 @@ benchmark json
other-modules: DerpConv
ghc-options: -Wall -rtsopts
build-depends:
, aeson ^>=1.4.6.0 || ^>=1.5.0.0 || ^>=2.0.0.0 || ^>=2.1.0.0
, attoparsec
, aeson ^>=1.4.6.0 || ^>=1.5.0.0 || ^>=2.0.0.0 || ^>=2.1.0.0 || ^>=2.2.1.0
, base
, bytestring
, clock ^>=0.8
Expand Down Expand Up @@ -180,9 +179,9 @@ test-suite properties
, base
, containers
, QuickCheck
, quickcheck-instances ^>=0.3.22
, quickcheck-instances ^>=0.3.30
, rere
, tasty ^>=1.4.0.1
, tasty ^>=1.4.0.1 || ^>=1.5
, tasty-quickcheck ^>=0.10.1.1

if flag(rere-intersection)
Expand Down

0 comments on commit 9c9b0a8

Please sign in to comment.