Skip to content

Commit

Permalink
Drop support for pre-8.0 versions of GHC
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Oct 27, 2024
1 parent 2c40463 commit ee3417d
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 139 deletions.
115 changes: 39 additions & 76 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.6
# version: 0.19.20240708
#
# REGENDATA ("0.16.6",["github","cabal.project"])
# REGENDATA ("0.19.20240708",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -23,19 +23,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.6.2
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.6.2
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.5
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.4.5
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.6
compilerKind: ghc
compilerVersion: 9.6.6
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 @@ -56,79 +66,39 @@ 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
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.4.4
compilerKind: ghc
compilerVersion: 8.4.4
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.2.2
compilerKind: ghc
compilerVersion: 8.2.2
setup-method: hvr-ppa
setup-method: ghcup
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
allow-failure: false
- compiler: ghc-7.4.2
compilerKind: ghc
compilerVersion: 7.4.2
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.2.2
compilerKind: ghc
compilerVersion: 7.2.2
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-7.0.4
compilerKind: ghc
compilerVersion: 7.0.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.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
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.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.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -140,20 +110,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.12.1.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,7 +173,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 @@ -238,15 +201,15 @@ jobs:
package data-reify
flags: +tests
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(data-reify)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(data-reify)$/; }' >> 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 All @@ -269,7 +232,7 @@ jobs:
run: |
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## next [????.??.??]
* Drop support for pre-8.0 versions of GHC.

## 0.6.3 [2020.10.12]
* Fix a bug introduced in `data-reify-0.6.2` where `reifyGraph` could return
`Graph`s with duplicate key-value pairs.
Expand Down
14 changes: 0 additions & 14 deletions Data/Reify.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
Expand All @@ -22,15 +21,6 @@ import Data.IntSet (IntSet)

import System.Mem.StableName

#if !(MIN_VERSION_base(4,7,0))
import Unsafe.Coerce
#endif

#if !(MIN_VERSION_base(4,8,0))
import Control.Applicative
import Data.Traversable
#endif

-- | 'MuRef' is a class that provided a way to reference into a specific type,
-- and a way to map over the deferenced internals.
class MuRef a where
Expand Down Expand Up @@ -139,11 +129,7 @@ instance Hashable DynStableName where

instance Eq DynStableName where
DynStableName m == DynStableName n =
#if MIN_VERSION_base(4,7,0)
eqStableName m n
#else
m == unsafeCoerce n
#endif

makeDynStableName :: a -> IO DynStableName
makeDynStableName a = do
Expand Down
22 changes: 10 additions & 12 deletions data-reify.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,18 @@ Homepage: http://ku-fpg.github.io/software/data-reify/
Stability: alpha
build-type: Simple
Cabal-Version: >= 1.10
tested-with: GHC == 7.0.4
, GHC == 7.2.2
, GHC == 7.4.2
, GHC == 7.6.3
, GHC == 7.8.4
, GHC == 7.10.3
, GHC == 8.0.2
tested-with: GHC == 8.0.2
, GHC == 8.2.2
, GHC == 8.4.4
, GHC == 8.6.5
, GHC == 8.8.4
, GHC == 8.10.7
, GHC == 9.0.2
, GHC == 9.2.8
, GHC == 9.4.5
, GHC == 9.6.2
, GHC == 9.4.8
, GHC == 9.6.6
, GHC == 9.8.2
, GHC == 9.10.1
extra-source-files: CHANGELOG.md, README.md

source-repository head
Expand All @@ -53,7 +49,10 @@ Flag tests


Library
Build-Depends: base >= 4 && < 5, hashable, containers, unordered-containers
Build-Depends: base >= 4.9 && < 5
, containers >= 0.5.7.1
, hashable
, unordered-containers
Exposed-modules:
Data.Reify,
Data.Reify.Graph
Expand All @@ -66,8 +65,7 @@ test-suite spec
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules: Data.ReifySpec
build-depends: base >= 4 && < 5
, base-compat >= 0.11 && < 0.15
build-depends: base
, data-reify
, hspec == 2.*
build-tool-depends: hspec-discover:hspec-discover == 2.*
Expand Down
9 changes: 1 addition & 8 deletions examples/example1.hs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{-# LANGUAGE CPP, TypeFamilies, DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# LANGUAGE TypeFamilies, DeriveFunctor, DeriveFoldable, DeriveTraversable #-}

module Main (DistF,Dist,D,share,expand,main) where

import Data.Reify
import Data.IntMap as IntMap

#if !(MIN_VERSION_base(4,8,0))
import Control.Applicative
import Data.Foldable
import Data.Monoid
import Data.Traversable
#endif

{-
This example was written by Edward Kmett for Johan Tibell,
and can be found at http://lpaste.net/74064
Expand Down
16 changes: 1 addition & 15 deletions examples/simplify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,15 @@
module Main (main) where

-- to define simplification
#if MIN_VERSION_containers(0,5,0)
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
#else
import qualified Data.Map as Map
import Data.Map (Map)
#endif
import Data.Reify (Graph(Graph), Unique)
import qualified Data.Set as Set

-- for the example
import Data.Reify (MuRef(mapDeRef), DeRef, reifyGraph)

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

#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0))
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup (Semigroup(..))
#endif

Expand Down Expand Up @@ -70,10 +58,8 @@ newtype Hist a = Hist (Map a Int)
count :: a -> Hist a
count x = Hist (Map.singleton x 1)

#if __GLASGOW_HASKELL__ >= 800
instance (Ord a) => Semigroup (Hist a) where
(<>) (Hist m1) (Hist m2) = Hist (Map.unionWith (+) m1 m2)
#endif

instance (Ord a) => Monoid (Hist a) where
mempty = Hist Map.empty
Expand Down
4 changes: 1 addition & 3 deletions spec/Data/ReifySpec.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Data.ReifySpec where

import qualified Data.List as L
import Data.Reify
import Prelude ()
import Prelude.Compat
import Test.Hspec

main :: IO ()
Expand Down
2 changes: 1 addition & 1 deletion test/Test4.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Main (main) where

import Common
Expand Down
2 changes: 1 addition & 1 deletion test/Test5.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Main (main) where

import Common
Expand Down
6 changes: 3 additions & 3 deletions test/Test6.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE TypeFamilies, UndecidableInstances, DeriveDataTypeable,
{-# LANGUAGE TypeFamilies, UndecidableInstances,
RankNTypes, ExistentialQuantification, TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Main (main) where

import Common
Expand Down Expand Up @@ -32,7 +32,7 @@ instance NewVar Exp where
-- return $ Var $ toDyn fn

data Exp = ExpVar Dynamic | ExpLit Int | ExpAdd Exp Exp
deriving (Typeable, Show)
deriving Show


instance Eq Exp where
Expand Down
Loading

0 comments on commit ee3417d

Please sign in to comment.