Skip to content

Commit c72a101

Browse files
committed
Drop support of GHC < 9
1 parent ae26e18 commit c72a101

33 files changed

+15
-179
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -48,53 +48,18 @@ jobs:
4848
compilerVersion: 9.0.2
4949
setup-method: ghcup
5050
allow-failure: false
51-
- compiler: ghc-8.10.7
52-
compilerKind: ghc
53-
compilerVersion: 8.10.7
54-
setup-method: ghcup
55-
allow-failure: false
56-
- compiler: ghc-8.8.4
57-
compilerKind: ghc
58-
compilerVersion: 8.8.4
59-
setup-method: hvr-ppa
60-
allow-failure: false
61-
- compiler: ghc-8.6.5
62-
compilerKind: ghc
63-
compilerVersion: 8.6.5
64-
setup-method: hvr-ppa
65-
allow-failure: false
66-
- compiler: ghc-8.4.4
67-
compilerKind: ghc
68-
compilerVersion: 8.4.4
69-
setup-method: hvr-ppa
70-
allow-failure: false
71-
- compiler: ghc-8.2.2
72-
compilerKind: ghc
73-
compilerVersion: 8.2.2
74-
setup-method: hvr-ppa
75-
allow-failure: false
7651
fail-fast: false
7752
steps:
7853
- name: apt
7954
run: |
8055
apt-get update
8156
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
82-
if [ "${{ matrix.setup-method }}" = ghcup ]; then
83-
mkdir -p "$HOME/.ghcup/bin"
84-
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
85-
chmod a+x "$HOME/.ghcup/bin/ghcup"
86-
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
87-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
88-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
89-
else
90-
apt-add-repository -y 'ppa:hvr/ghc'
91-
apt-get update
92-
apt-get install -y "$HCNAME"
93-
mkdir -p "$HOME/.ghcup/bin"
94-
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
95-
chmod a+x "$HOME/.ghcup/bin/ghcup"
96-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
97-
fi
57+
mkdir -p "$HOME/.ghcup/bin"
58+
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
59+
chmod a+x "$HOME/.ghcup/bin/ghcup"
60+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
61+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
62+
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
9863
env:
9964
HCKIND: ${{ matrix.compilerKind }}
10065
HCNAME: ${{ matrix.compiler }}
@@ -106,20 +71,11 @@ jobs:
10671
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
10772
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
10873
HCDIR=/opt/$HCKIND/$HCVER
109-
if [ "${{ matrix.setup-method }}" = ghcup ]; then
110-
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
111-
echo "HC=$HC" >> "$GITHUB_ENV"
112-
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
113-
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
114-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
115-
else
116-
HC=$HCDIR/bin/$HCKIND
117-
echo "HC=$HC" >> "$GITHUB_ENV"
118-
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
119-
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
120-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
121-
fi
122-
74+
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
75+
echo "HC=$HC" >> "$GITHUB_ENV"
76+
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
77+
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
78+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
12379
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
12480
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
12581
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"

Math/NumberTheory/ArithmeticFunctions/Class.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
-- factorisation domains.
99
--
1010

11-
{-# LANGUAGE CPP #-}
1211
{-# LANGUAGE GADTs #-}
1312

1413
module Math.NumberTheory.ArithmeticFunctions.Class
@@ -18,9 +17,6 @@ module Math.NumberTheory.ArithmeticFunctions.Class
1817
) where
1918

2019
import Control.Applicative
21-
#if __GLASGOW_HASKELL__ < 803
22-
import Data.Semigroup
23-
#endif
2420
import Prelude hiding (Applicative(..))
2521

2622
import Math.NumberTheory.Primes
@@ -66,11 +62,7 @@ instance Semigroup a => Semigroup (ArithmeticFunction n a) where
6662

6763
instance Monoid a => Monoid (ArithmeticFunction n a) where
6864
mempty = pure mempty
69-
#if __GLASGOW_HASKELL__ < 803
70-
mappend = liftA2 mappend
71-
#else
7265
mappend = (<>)
73-
#endif
7466

7567
-- | Factorisation is expensive, so it is better to avoid doing it twice.
7668
-- Write 'runFunction (f + g) n' instead of 'runFunction f n + runFunction g n'.

Math/NumberTheory/ArithmeticFunctions/Inverse.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
-- <https://www.emis.de/journals/JIS/VOL19/Alekseyev/alek5.pdf Computing the Inverses, their Power Sums, and Extrema for Euler’s Totient and Other Multiplicative Functions>
1010
-- by M. A. Alekseyev.
1111

12-
{-# LANGUAGE CPP #-}
1312
{-# LANGUAGE FlexibleContexts #-}
1413
{-# LANGUAGE RankNTypes #-}
1514
{-# LANGUAGE ScopedTypeVariables #-}
@@ -37,9 +36,6 @@ import Data.Map (Map)
3736
import qualified Data.Map as M
3837
import Data.Maybe
3938
import Data.Ord (Down(..))
40-
#if __GLASGOW_HASKELL__ < 803
41-
import Data.Semigroup
42-
#endif
4339
import Data.Semiring (Semiring(..), Mul(..))
4440
import Data.Set (Set)
4541
import qualified Data.Set as S

Math/NumberTheory/ArithmeticFunctions/Moebius.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
--
99

1010
{-# LANGUAGE BangPatterns #-}
11-
{-# LANGUAGE CPP #-}
1211
{-# LANGUAGE MagicHash #-}
1312
{-# LANGUAGE MultiParamTypeClasses #-}
1413
{-# LANGUAGE TypeFamilies #-}
@@ -24,9 +23,6 @@ import Control.Monad.ST (runST)
2423
import Data.Bits
2524
import Data.Int
2625
import Data.Word
27-
#if __GLASGOW_HASKELL__ < 803
28-
import Data.Semigroup
29-
#endif
3026
import qualified Data.Vector.Generic as G
3127
import qualified Data.Vector.Generic.Mutable as M
3228
import qualified Data.Vector.Primitive as P

Math/NumberTheory/DirichletCharacters.hs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
-- Implementation and enumeration of Dirichlet characters.
88
--
99

10-
{-# LANGUAGE CPP #-}
1110
{-# LANGUAGE DataKinds #-}
1211
{-# LANGUAGE GADTs #-}
13-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1412
{-# LANGUAGE KindSignatures #-}
1513
{-# LANGUAGE LambdaCase #-}
1614
{-# LANGUAGE PatternSynonyms #-}
@@ -59,9 +57,6 @@ module Math.NumberTheory.DirichletCharacters
5957
, validChar
6058
) where
6159

62-
#if !MIN_VERSION_base(4,12,0)
63-
import Control.Applicative (liftA2)
64-
#endif
6560
import Data.Bits (Bits(..))
6661
import Data.Constraint
6762
import Data.Foldable
@@ -70,9 +65,7 @@ import Data.Kind
7065
import Data.List (sort, unfoldr)
7166
import Data.Maybe (mapMaybe, fromJust, fromMaybe)
7267
import Data.Mod
73-
#if MIN_VERSION_base(4,12,0)
7468
import Data.Monoid (Ap(..))
75-
#endif
7669
import Data.Proxy (Proxy(..))
7770
import Data.Ratio ((%), numerator, denominator)
7871
import Data.Semigroup (Semigroup(..),Product(..))
@@ -466,18 +459,6 @@ makePrimitive (Generated xs) =
466459
where options = [(i, bit (i-2) :: Natural) | i <- [2..k]]
467460
worksb (_,phi) = phi `stimes` b == mempty
468461

469-
#if !MIN_VERSION_base(4,12,0)
470-
newtype Ap f a = Ap { getAp :: f a }
471-
deriving (Eq, Functor, Applicative, Monad)
472-
473-
instance (Applicative f, Semigroup a) => Semigroup (Ap f a) where
474-
(<>) = liftA2 (<>)
475-
476-
instance (Applicative f, Semigroup a, Monoid a) => Monoid (Ap f a) where
477-
mempty = pure mempty
478-
mappend = (<>)
479-
#endif
480-
481462
-- | Similar to Maybe, but with different Semigroup and Monoid instances.
482463
type OrZero a = Ap Maybe a
483464

Math/NumberTheory/Euclidean/Coprimes.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
--
77
-- Container for pairwise coprime numbers.
88

9-
{-# LANGUAGE CPP #-}
109
{-# LANGUAGE ScopedTypeVariables #-}
1110
{-# LANGUAGE TupleSections #-}
1211

@@ -23,9 +22,6 @@ import Data.Coerce
2322
import Data.Euclidean
2423
import Data.List (tails)
2524
import Data.Maybe
26-
#if __GLASGOW_HASKELL__ < 803
27-
import Data.Semigroup
28-
#endif
2925
import Data.Semiring (Semiring(..), isZero)
3026
import Data.Traversable
3127

Math/NumberTheory/Moduli/JacobiSymbol.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
--
1212

1313
{-# LANGUAGE BangPatterns #-}
14-
{-# LANGUAGE CPP #-}
1514
{-# LANGUAGE LambdaCase #-}
1615

1716
module Math.NumberTheory.Moduli.JacobiSymbol
@@ -21,9 +20,6 @@ module Math.NumberTheory.Moduli.JacobiSymbol
2120
) where
2221

2322
import Data.Bits
24-
#if __GLASGOW_HASKELL__ < 803
25-
import Data.Semigroup
26-
#endif
2723
import Numeric.Natural
2824

2925
import Math.NumberTheory.Utils

Math/NumberTheory/Moduli/Singleton.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
-- Singleton data types.
88
--
99

10-
{-# LANGUAGE CPP #-}
1110
{-# LANGUAGE DataKinds #-}
1211
{-# LANGUAGE DeriveGeneric #-}
1312
{-# LANGUAGE FlexibleInstances #-}
@@ -51,9 +50,6 @@ import Data.Kind
5150
import Data.List (sort)
5251
import qualified Data.Map as M
5352
import Data.Proxy
54-
#if __GLASGOW_HASKELL__ < 803
55-
import Data.Semigroup
56-
#endif
5753
import GHC.Generics
5854
import GHC.TypeNats (KnownNat, Nat, natVal)
5955
import Numeric.Natural
@@ -315,6 +311,4 @@ pattern CGOddPrimePower p k <- CGOddPrimePower' p k
315311
pattern CGDoubleOddPrimePower :: Prime a -> Word -> CyclicGroup a m
316312
pattern CGDoubleOddPrimePower p k <- CGDoubleOddPrimePower' p k
317313

318-
#if __GLASGOW_HASKELL__ > 801
319314
{-# COMPLETE CG2, CG4, CGOddPrimePower, CGDoubleOddPrimePower #-}
320-
#endif

Math/NumberTheory/Moduli/SomeMod.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
-- Safe modular arithmetic with modulo on type level.
88
--
99

10-
{-# LANGUAGE CPP #-}
1110
{-# LANGUAGE GADTs #-}
1211
{-# LANGUAGE LambdaCase #-}
1312
{-# LANGUAGE RankNTypes #-}
@@ -23,9 +22,6 @@ module Math.NumberTheory.Moduli.SomeMod
2322
import Data.Euclidean (GcdDomain(..), Euclidean(..), Field)
2423
import Data.Mod
2524
import Data.Proxy
26-
#if __GLASGOW_HASKELL__ < 803
27-
import Data.Semigroup
28-
#endif
2925
import Data.Semiring (Semiring(..), Ring(..))
3026
import Data.Type.Equality
3127
import GHC.TypeNats (KnownNat, SomeNat(..), sameNat, natVal, someNatVal)

Math/NumberTheory/Primes/Factorisation/LinearAlgebra.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
-- <http://www.enseignement.polytechnique.fr/profs/informatique/Francois.Morain/Master1/Crypto/projects/Wiedemann86.pdf Weidemann algorithm>
88
-- to find a non-zero element in the kernel of a singular sparse binary matrix.
99

10-
{-# LANGUAGE CPP #-}
1110
{-# LANGUAGE GADTs #-}
1211
{-# LANGUAGE DataKinds #-}
1312
{-# LANGUAGE KindSignatures #-}
@@ -24,9 +23,6 @@ module Math.NumberTheory.Primes.Factorisation.LinearAlgebra
2423
, linearSolve
2524
) where
2625

27-
#if __GLASGOW_HASKELL__ < 803
28-
import Data.Semigroup
29-
#endif
3026
import qualified Data.List as L
3127
import qualified Data.Vector as V
3228
import qualified Data.Vector.Sized as SV

0 commit comments

Comments
 (0)