Skip to content

Commit db40495

Browse files
authored
Drop support for GHC < 8.10 (#510)
* Drop support for GHC < 8.10 * Require nothunks unconditionally * Remove dependency on mtl * Remove conditions from ghc-options
1 parent d01d70e commit db40495

File tree

7 files changed

+19
-84
lines changed

7 files changed

+19
-84
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.19.20250506
11+
# version: 0.19.20250917
1212
#
13-
# REGENDATA ("0.19.20250506",["github","unordered-containers.cabal"])
13+
# REGENDATA ("0.19.20250917",["github","unordered-containers.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -20,6 +20,9 @@ on:
2020
pull_request:
2121
branches:
2222
- master
23+
merge_group:
24+
branches:
25+
- master
2326
jobs:
2427
linux:
2528
name: Haskell-CI - Linux - ${{ matrix.compiler }}
@@ -72,41 +75,21 @@ jobs:
7275
compilerVersion: 8.10.7
7376
setup-method: ghcup
7477
allow-failure: false
75-
- compiler: ghc-8.8.4
76-
compilerKind: ghc
77-
compilerVersion: 8.8.4
78-
setup-method: ghcup
79-
allow-failure: false
80-
- compiler: ghc-8.6.5
81-
compilerKind: ghc
82-
compilerVersion: 8.6.5
83-
setup-method: ghcup
84-
allow-failure: false
85-
- compiler: ghc-8.4.4
86-
compilerKind: ghc
87-
compilerVersion: 8.4.4
88-
setup-method: ghcup
89-
allow-failure: false
90-
- compiler: ghc-8.2.2
91-
compilerKind: ghc
92-
compilerVersion: 8.2.2
93-
setup-method: ghcup
94-
allow-failure: false
9578
fail-fast: false
9679
steps:
9780
- name: apt-get install
9881
run: |
9982
apt-get update
100-
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
83+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
10184
- name: Install GHCup
10285
run: |
10386
mkdir -p "$HOME/.ghcup/bin"
10487
curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
10588
chmod a+x "$HOME/.ghcup/bin/ghcup"
10689
- name: Install cabal-install
10790
run: |
108-
"$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
109-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
91+
"$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
92+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
11093
- name: Install GHC (GHCup)
11194
if: matrix.setup-method == 'ghcup'
11295
run: |
@@ -182,7 +165,7 @@ jobs:
182165
chmod a+x $HOME/.cabal/bin/cabal-plan
183166
cabal-plan --version
184167
- name: checkout
185-
uses: actions/checkout@v4
168+
uses: actions/checkout@v5
186169
with:
187170
path: source
188171
- name: initial cabal.project for sdist
@@ -207,7 +190,11 @@ jobs:
207190
touch cabal.project.local
208191
echo "packages: ${PKGDIR_unordered_containers}" >> cabal.project
209192
echo "package unordered-containers" >> cabal.project
210-
echo " ghc-options: -Werror=missing-methods" >> cabal.project
193+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
194+
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package unordered-containers" >> cabal.project ; fi
195+
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
196+
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package unordered-containers" >> cabal.project ; fi
197+
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi
211198
cat >> cabal.project <<EOF
212199
EOF
213200
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(binary|containers|unordered-containers)$/; }' >> cabal.project.local

Data/HashMap/Internal.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,7 @@ instance (NFData k, NFData v) => NFData (Leaf k v) where
192192

193193
-- | @since 0.2.17.0
194194
instance (TH.Lift k, TH.Lift v) => TH.Lift (Leaf k v) where
195-
#if MIN_VERSION_template_haskell(2,16,0)
196195
liftTyped (L k v) = [|| L k $! v ||]
197-
#else
198-
lift (L k v) = [| L k $! v |]
199-
#endif
200196

201197
-- | @since 0.2.14.0
202198
instance NFData k => NFData1 (Leaf k) where

Data/HashMap/Internal/Array.hs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,13 @@ new _n@(I# n#) b =
207207
new_ :: Int -> ST s (MArray s a)
208208
new_ n = new n undefinedElem
209209

210-
-- | When 'Exts.shrinkSmallMutableArray#' is available, the returned array is the same as the array given, as it is shrunk in place.
211-
-- Otherwise a copy is made.
210+
-- | The returned array is the same as the array given, as it is shrunk in place.
212211
shrink :: MArray s a -> Int -> ST s (MArray s a)
213-
#if __GLASGOW_HASKELL__ >= 810
214212
shrink mary _n@(I# n#) =
215213
CHECK_GT("shrink", _n, (0 :: Int))
216214
CHECK_LE("shrink", _n, (lengthM mary))
217215
ST $ \s -> case Exts.shrinkSmallMutableArray# (unMArray mary) n# s of
218216
s' -> (# s', mary #)
219-
#else
220-
shrink mary n = cloneM mary 0 n
221-
#endif
222217
{-# INLINE shrink #-}
223218

224219
singleton :: a -> Array a
@@ -516,11 +511,7 @@ fromList' n xs0 =
516511

517512
-- | @since 0.2.17.0
518513
instance TH.Lift a => TH.Lift (Array a) where
519-
#if MIN_VERSION_template_haskell(2,16,0)
520514
liftTyped ar = [|| fromList' arlen arlist ||]
521-
#else
522-
lift ar = [| fromList' arlen arlist |]
523-
#endif
524515
where
525516
arlen = length ar
526517
arlist = toList ar

Data/HashMap/Internal/Debug.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ import Data.Semigroup (Sum (..))
3535

3636
import qualified Data.HashMap.Internal.Array as A
3737

38-
39-
#if !MIN_VERSION_base(4,11,0)
40-
import Data.Semigroup (Semigroup (..))
41-
#endif
42-
4338
data Validity k = Invalid (Error k) SubHashPath | Valid
4439
deriving (Eq, Show)
4540

Data/HashMap/Internal/List.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ module Data.HashMap.Internal.List
2828

2929
import Data.List (sortBy)
3030
import Data.Maybe (fromMaybe)
31-
#if !MIN_VERSION_base(4,11,0)
32-
import Data.Semigroup ((<>))
33-
#endif
3431

3532
-- Note: previous implementation isPermutation = null (as // bs)
3633
-- was O(n^2) too.

tests/Regressions.hs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ import qualified Data.HashMap.Strict as HMS
2929
import qualified Data.HashSet as HS
3030
import qualified Test.Tasty as Tasty
3131

32-
#if MIN_VERSION_base(4,12,0)
33-
-- nothunks requires base >= 4.12
34-
#define HAVE_NOTHUNKS
3532
import qualified Data.Foldable as Foldable
3633
import NoThunks.Class (noThunksInValues)
37-
#endif
3834

3935
issue32 :: Assertion
4036
issue32 = assert $ isJust $ HMS.lookup 7 m'
@@ -141,7 +137,6 @@ issue254Strict = do
141137
------------------------------------------------------------------------
142138
-- Issue #379
143139

144-
#ifdef HAVE_NOTHUNKS
145140

146141
issue379Union :: Assertion
147142
issue379Union = do
@@ -167,8 +162,6 @@ issue379StrictUnionWithKey = do
167162
mThunkInfo <- noThunksInValues mempty (Foldable.toList u)
168163
assert $ isNothing mThunkInfo
169164

170-
#endif
171-
172165
-- Another key type that always collides.
173166
--
174167
-- Note (sjakobi): The KC newtype of Int somehow can't be used to demonstrate
@@ -196,8 +189,6 @@ issue379LazyUnionWith = do
196189
------------------------------------------------------------------------
197190
-- Issue #381
198191

199-
#ifdef HAVE_NOTHUNKS
200-
201192
issue381mapMaybe :: Assertion
202193
issue381mapMaybe = do
203194
let m0 = HMS.fromList [(KC 1, 10), (KC 2, 20 :: Int)]
@@ -212,8 +203,6 @@ issue381mapMaybeWithKey = do
212203
mThunkInfo <- noThunksInValues mempty (Foldable.toList m1)
213204
assert $ isNothing mThunkInfo
214205

215-
#endif
216-
217206
------------------------------------------------------------------------
218207
-- Issue #382
219208

@@ -234,8 +223,6 @@ issue382 = do
234223
------------------------------------------------------------------------
235224
-- Issue #383
236225

237-
#ifdef HAVE_NOTHUNKS
238-
239226
-- Custom Functor to prevent interference from alterF rules
240227
newtype MyIdentity a = MyIdentity a
241228
instance Functor MyIdentity where
@@ -250,8 +237,6 @@ issue383 = do
250237
mThunkInfo <- noThunksInValues mempty (Foldable.toList m)
251238
assert $ isNothing mThunkInfo
252239

253-
#endif
254-
255240
------------------------------------------------------------------------
256241
-- Issue #420
257242

@@ -288,22 +273,16 @@ tests = testGroup "Regression tests"
288273
, testCase "issue254 strict" issue254Strict
289274
, testGroup "issue379"
290275
[ testCase "Lazy.unionWith" issue379LazyUnionWith
291-
#ifdef HAVE_NOTHUNKS
292276
, testCase "union" issue379Union
293277
, testCase "Strict.unionWith" issue379StrictUnionWith
294278
, testCase "Strict.unionWithKey" issue379StrictUnionWithKey
295-
#endif
296279
]
297-
#ifdef HAVE_NOTHUNKS
298280
, testGroup "issue381"
299281
[ testCase "mapMaybe" issue381mapMaybe
300282
, testCase "mapMaybeWithKey" issue381mapMaybeWithKey
301283
]
302-
#endif
303284
, testCase "issue382" issue382
304-
#ifdef HAVE_NOTHUNKS
305285
, testCase "issue383" issue383
306-
#endif
307286
, testCase "issue420" issue420
308287
, issue491
309288
]

unordered-containers.cabal

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ tested-with:
3737
|| ==9.2.8
3838
|| ==9.0.2
3939
|| ==8.10.7
40-
|| ==8.8.4
41-
|| ==8.6.5
42-
|| ==8.4.4
43-
|| ==8.2.2
4440

4541
flag debug
4642
description: Enable debug support
@@ -59,10 +55,10 @@ library
5955
Data.HashSet.Internal
6056

6157
build-depends:
62-
base >= 4.10 && < 5,
58+
base >= 4.14 && < 5,
6359
deepseq >= 1.4.3,
6460
hashable >= 1.4 && < 1.6,
65-
template-haskell < 2.24
61+
template-haskell >= 2.16 && < 2.24
6662

6763
default-language: Haskell2010
6864

@@ -104,16 +100,13 @@ test-suite unordered-containers-tests
104100
hashable,
105101
HUnit,
106102
QuickCheck >= 2.4.0.1,
103+
nothunks >= 0.1.3,
107104
random,
108105
tasty >= 1.4.0.3,
109106
tasty-hunit >= 0.10.0.3,
110107
tasty-quickcheck >= 0.10.1.2,
111108
unordered-containers
112109

113-
if impl(ghc >= 8.6)
114-
build-depends:
115-
nothunks >= 0.1.3
116-
117110
default-language: Haskell2010
118111
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
119112
cpp-options: -DASSERTS
@@ -135,15 +128,12 @@ benchmark benchmarks
135128
deepseq,
136129
hashable,
137130
hashmap,
138-
mtl,
139131
random,
140132
tasty-bench >= 0.3.1,
141133
unordered-containers
142134

143135
default-language: Haskell2010
144-
ghc-options: -Wall -O2 -rtsopts -with-rtsopts=-A32m
145-
if impl(ghc >= 8.10)
146-
ghc-options: "-with-rtsopts=-A32m --nonmoving-gc"
136+
ghc-options: -Wall -O2 -rtsopts "-with-rtsopts=-A32m --nonmoving-gc"
147137
-- cpp-options: -DBENCH_containers_Map -DBENCH_containers_IntMap -DBENCH_hashmap_Map
148138

149139
source-repository head

0 commit comments

Comments
 (0)