Skip to content

Commit

Permalink
Merge pull request #39 from well-typed/edsko/ghc-9.8
Browse files Browse the repository at this point in the history
Support 9.8 and 9.10
  • Loading branch information
edsko authored Jun 12, 2024
2 parents 4d57d76 + 1b75e56 commit 6777034
Show file tree
Hide file tree
Showing 16 changed files with 312 additions and 94 deletions.
70 changes: 29 additions & 41 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.3
# version: 0.19.20240608
#
# REGENDATA ("0.16.3",["github","recover-rtti.cabal"])
# REGENDATA ("0.19.20240608",["github","recover-rtti.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -23,11 +23,21 @@ 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.10.1
compilerKind: ghc
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.2
compilerKind: ghc
compilerVersion: 9.6.2
Expand All @@ -53,32 +63,17 @@ jobs:
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: hvr-ppa
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.2/x86_64-linux-ghcup-0.1.19.2 > "$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.2/x86_64-linux-ghcup-0.1.19.2 > "$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 @@ -90,20 +85,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/$HCKIND-$HCVER
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 "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 @@ -160,7 +148,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 Down Expand Up @@ -188,15 +176,15 @@ jobs:
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 /^(recover-rtti)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(recover-rtti)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
run: |
$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 @@ -226,7 +214,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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Revision history for recover-rtti

## 0.5.0 -- 2024-06-12

* Support ghc 9.8 and 9.10, including bytestring 0.12
* Support `ByteArray` and `MutableByteArray`
* Relax bounds (Marcin Szamotulski, #38)
* Drop support for ghc 8.8

## 0.4.3 -- 2023-06-05

* Support aeson 2.1, vector 0.13, and primitive 0.8
Expand Down
30 changes: 19 additions & 11 deletions recover-rtti.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: recover-rtti
version: 0.4.3
version: 0.5.0
synopsis: Recover run-time type information from the GHC heap
description: The main function in this package is 'classify', which looks
at the GHC heap to recover type information about arbitrary
Expand All @@ -20,12 +20,13 @@ extra-source-files:
README.md
CHANGELOG.md

Tested-With: GHC ==8.8.4
|| ==8.10.7
Tested-With: GHC ==8.10.7
|| ==9.0.2
|| ==9.2.7
|| ==9.4.5
|| ==9.6.2
|| ==9.8.2
|| ==9.10.1

source-repository head
type: git
Expand All @@ -50,15 +51,15 @@ library
Debug.RecoverRTTI.Util
Debug.RecoverRTTI.Wrappers

build-depends: base >= 4.13 && < 4.19
, aeson >= 1.4 && < 2.2
, bytestring >= 0.10 && < 0.12
, containers >= 0.6 && < 0.7
, ghc-heap >= 8.8 && < 9.7
, ghc-prim >= 0.5 && < 0.11
build-depends: base >= 4.13 && < 4.21
, aeson >= 1.4 && < 2.3
, bytestring >= 0.10 && < 0.13
, containers >= 0.6 && < 0.8
, ghc-heap >= 8.8 && < 9.11
, ghc-prim >= 0.5 && < 0.12
, sop-core >= 0.5 && < 0.6
, stm >= 2.5 && < 2.6
, text >= 1.2 && < 2.1
, text >= 1.2 && < 2.2

-- mtl 2.3 does not have ExceptT?
, mtl (>= 2.2 && < 2.3) || (>= 2.3.1 && < 2.4)
Expand All @@ -70,7 +71,14 @@ library
-- The dependencies below are the oldest versions of
-- these packages that compile with this ghc version.
, vector >= 0.12.1.2 && < 0.14
, primitive >= 0.7 && < 0.9
, primitive >= 0.7 && < 0.10

-- later versions of primitive use a compat package for Data.Array.Byte
if impl(ghc < 9.4)
build-depends: data-array-byte >= 0.1 && < 0.2

if impl(ghc >= 9.10)
build-depends: ghc-internal

hs-source-dirs: src
default-language: Haskell2010
Expand Down
1 change: 1 addition & 0 deletions src/Debug/RecoverRTTI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module Debug.RecoverRTTI (
, SomeStorableVectorM(..)
, SomePrimitiveVector(..)
, SomePrimitiveVectorM(..)
, SomeMutableByteArray(..)
-- * Working with classifiers
-- ** Mapping
, mapClassifier
Expand Down
15 changes: 13 additions & 2 deletions src/Debug/RecoverRTTI/CheckSame.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
Expand Down Expand Up @@ -52,10 +53,13 @@ samePrim = go
go C_String C_String = Just Refl
go C_BS_Strict C_BS_Strict = Just Refl
go C_BS_Lazy C_BS_Lazy = Just Refl
go C_BS_Short C_BS_Short = Just Refl
go C_Text_Strict C_Text_Strict = Just Refl
go C_Text_Lazy C_Text_Lazy = Just Refl

#if !MIN_VERSION_bytestring(0,12,0)
go C_BS_Short C_BS_Short = Just Refl
#endif

-- Aeson

go C_Value C_Value = Just Refl
Expand All @@ -74,6 +78,8 @@ samePrim = go
go C_Vector_StorableM C_Vector_StorableM = Just Refl
go C_Vector_Primitive C_Vector_Primitive = Just Refl
go C_Vector_PrimitiveM C_Vector_PrimitiveM = Just Refl
go C_ByteArray C_ByteArray = Just Refl
go C_MutableByteArray C_MutableByteArray = Just Refl

-- Functions

Expand Down Expand Up @@ -109,10 +115,13 @@ samePrim = go
C_String -> ()
C_BS_Strict -> ()
C_BS_Lazy -> ()
C_BS_Short -> ()
C_Text_Strict -> ()
C_Text_Lazy -> ()

#if !MIN_VERSION_bytestring(0,12,0)
C_BS_Short -> ()
#endif

-- Aeson

C_Value -> ()
Expand All @@ -131,6 +140,8 @@ samePrim = go
C_Vector_StorableM -> ()
C_Vector_Primitive -> ()
C_Vector_PrimitiveM -> ()
C_ByteArray -> ()
C_MutableByteArray -> ()

-- Functions

Expand Down
15 changes: 13 additions & 2 deletions src/Debug/RecoverRTTI/Classifier.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
Expand Down Expand Up @@ -41,13 +42,17 @@ import Data.Word

import qualified Data.ByteString as BS.Strict
import qualified Data.ByteString.Lazy as BS.Lazy
import qualified Data.ByteString.Short as BS.Short
import qualified Data.HashMap.Internal.Array as HashMap (Array)
import qualified Data.Primitive.Array as Prim (Array)
import qualified Data.Primitive.ByteArray as Prim (ByteArray)
import qualified Data.Text as Text.Strict
import qualified Data.Text.Lazy as Text.Lazy
import qualified Data.Vector as Vector.Boxed

#if !MIN_VERSION_bytestring(0,12,0)
import qualified Data.ByteString.Short as BS.Short
#endif

import Debug.RecoverRTTI.Nat
import Debug.RecoverRTTI.Tuple
import Debug.RecoverRTTI.Wrappers
Expand Down Expand Up @@ -153,10 +158,14 @@ data PrimClassifier (a :: Type) where
C_String :: PrimClassifier String
C_BS_Strict :: PrimClassifier BS.Strict.ByteString
C_BS_Lazy :: PrimClassifier BS.Lazy.ByteString
C_BS_Short :: PrimClassifier BS.Short.ShortByteString
C_Text_Strict :: PrimClassifier Text.Strict.Text
C_Text_Lazy :: PrimClassifier Text.Lazy.Text

-- in bytestring 0.12, 'ShortByteStringSource' is a newtype around 'ByteArray'
#if !MIN_VERSION_bytestring(0,12,0)
C_BS_Short :: PrimClassifier BS.Short.ShortByteString
#endif

-- Aeson

C_Value :: PrimClassifier Value
Expand All @@ -182,6 +191,8 @@ data PrimClassifier (a :: Type) where
C_Vector_StorableM :: PrimClassifier SomeStorableVectorM
C_Vector_Primitive :: PrimClassifier SomePrimitiveVector
C_Vector_PrimitiveM :: PrimClassifier SomePrimitiveVectorM
C_ByteArray :: PrimClassifier Prim.ByteArray
C_MutableByteArray :: PrimClassifier SomeMutableByteArray

{-------------------------------------------------------------------------------
Nested classification
Expand Down
14 changes: 14 additions & 0 deletions src/Debug/RecoverRTTI/Classify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ classifyIO x = do
#endif
(inKnownModule DataByteStringLazyInternal -> Just "Empty") -> return $ mustBe $ C_Prim C_BS_Lazy
(inKnownModule DataByteStringLazyInternal -> Just "Chunk") -> return $ mustBe $ C_Prim C_BS_Lazy
#if !MIN_VERSION_bytestring(0,12,0)
(inKnownModule DataByteStringShortInternal -> Just "SBS") -> return $ mustBe $ C_Prim C_BS_Short
#endif

-- text
(inKnownModule DataTextInternal -> Just "Text") -> return $ mustBe $ C_Prim C_Text_Strict
Expand Down Expand Up @@ -252,6 +254,18 @@ classifyIO x = do
(inKnownModule DataPrimitiveArray -> Just "MutableArray") ->
return $ mustBe $ C_Prim C_Prim_ArrayM

#if !MIN_VERSION_primitive(0,8,0)
(inKnownModule DataPrimitiveByteArray -> Just "ByteArray") ->
return $ mustBe $ C_Prim C_ByteArray
(inKnownModule DataPrimitiveByteArray -> Just "MutableByteArray") ->
return $ mustBe $ C_Prim C_MutableByteArray
#else
(inKnownModule DataArrayByte -> Just "ByteArray") ->
return $ mustBe $ C_Prim C_ByteArray
(inKnownModule DataArrayByte -> Just "MutableByteArray") ->
return $ mustBe $ C_Prim C_MutableByteArray
#endif

-- Boxed vectors
(inKnownModule DataVector -> Just "Vector") ->
mustBe <$> classifyVectorBoxed (unsafeCoerce x)
Expand Down
Loading

0 comments on commit 6777034

Please sign in to comment.