Skip to content

Commit 88b326e

Browse files
committed
build with 9.10.1. Clean warnings and upd CI
1 parent 625ecd5 commit 88b326e

File tree

4 files changed

+57
-31
lines changed

4 files changed

+57
-31
lines changed

.github/workflows/haskell.yml

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,61 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
ghc: ['8.4.4', '8.6.5', '8.8.4', '8.10.7', '9.0.1', '9.2.5', '9.4.5', '9.6.1']
11-
os: ['ubuntu-latest', 'macos-latest']
10+
ghc: ['8.6', '8.10', '9.4', '9.6', '9.8', '9.10']
11+
os: ['ubuntu-latest']
12+
include:
13+
- ghc: '9.10'
14+
os: 'macos-latest'
1215
runs-on: ${{ matrix.os }}
1316

1417
name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
1518
steps:
16-
- uses: actions/checkout@v3
17-
- uses: haskell/actions/setup@v2
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up GHC ${{ matrix.ghc-version }}
22+
uses: haskell-actions/setup@v2
23+
id: setup
1824
with:
1925
ghc-version: ${{ matrix.ghc }}
20-
cabal-version: '3.10.1.0'
21-
- name: Cache
22-
uses: actions/cache@v3
26+
27+
- name: Configure the build
28+
run: |
29+
cabal configure --enable-tests --enable-benchmarks --enable-documentation
30+
cabal build all --dry-run
31+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
32+
33+
- name: Restore cached dependencies
34+
uses: actions/cache/restore@v4
35+
id: cache
2336
env:
24-
cache-name: cache-cabal
37+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
2538
with:
26-
path: ~/.cabal
27-
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
28-
restore-keys: |
29-
${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
30-
${{ runner.os }}-${{ matrix.ghc }}-build-
31-
${{ runner.os }}-${{ matrix.ghc }}-
32-
${{ runner.os }}
39+
path: ${{ steps.setup.outputs.cabal-store }}
40+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
41+
restore-keys: ${{ env.key }}-
3342

3443
- name: Install dependencies
35-
run: cabal build --only-dependencies --enable-tests --enable-benchmarks
44+
# If we had an exact cache hit, the dependencies will be up to date.
45+
if: steps.cache.outputs.cache-hit != 'true'
46+
run: cabal build all --only-dependencies
47+
48+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
49+
- name: Save cached dependencies
50+
uses: actions/cache/save@v4
51+
# If we had an exact cache hit, trying to save the cache would error because of key clash.
52+
if: steps.cache.outputs.cache-hit != 'true'
53+
with:
54+
path: ${{ steps.setup.outputs.cabal-store }}
55+
key: ${{ steps.cache.outputs.cache-primary-key }}
56+
3657
- name: Build
37-
run: cabal build --enable-tests --enable-benchmarks all
58+
run: cabal build all
59+
3860
- name: Run tests
39-
# We don't run hlint tests, because different versions of hlint have different suggestions, and we don't want to worry about satisfying them all.
40-
run: cabal test --enable-tests -f-hlint all
41-
- if: matrix.ghc != '8.4.4'
42-
# docs aren't built on ghc 8.4.4 because some dependency docs don't build on older GHCs
43-
name: Build Docs
44-
run: cabal haddock
61+
run: cabal test all
62+
63+
- name: Check cabal file
64+
run: cabal check
65+
66+
- name: Build documentation
67+
run: cabal haddock all

patch.cabal

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ flag hlint
3737
library
3838
hs-source-dirs: src
3939
default-language: Haskell2010
40-
build-depends: base >= 4.9 && < 4.19
40+
build-depends: base >= 4.9 && < 4.21
4141
, constraints-extras >= 0.3 && < 0.5
42-
, commutative-semigroups >= 0.0 && < 0.2
43-
, containers >= 0.6 && < 0.7
42+
, commutative-semigroups >= 0.0 && < 0.3
43+
, containers >= 0.6 && < 0.8
4444
, dependent-map >= 0.3 && < 0.5
4545
, dependent-sum >= 0.6 && < 0.8
46-
, lens >= 4.7 && < 5.3
46+
, lens >= 4.7 && < 5.4
4747
, indexed-traversable >= 0.1 && < 0.2
4848
, semigroupoids >= 4.0 && < 7
4949
, transformers >= 0.5.6.0 && < 0.7
50-
, witherable >= 0.3 && < 0.5
50+
, witherable >= 0.3 && < 0.6
5151

5252
if impl(ghc < 8.6)
5353
build-depends: base-orphans >= 0.8 && < 0.9
@@ -66,7 +66,7 @@ library
6666
, Data.Semigroup.Additive
6767

6868
ghc-options: -Wall -fwarn-redundant-constraints -fwarn-tabs
69-
default-extensions: PolyKinds
69+
default-extensions: PolyKinds, TypeOperators
7070

7171
if flag(split-these)
7272
build-depends: these >= 1 && <1.3

src/Data/Patch.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ module Data.Patch
1414
) where
1515

1616
import Data.Semigroup.Commutative
17+
#if !MIN_VERSION_base(4,18,0)
1718
import Control.Applicative (liftA2)
19+
#endif
1820
import Data.Functor.Const (Const (..))
1921
import Data.Functor.Identity
2022
import Data.Map.Monoidal (MonoidalMap)
@@ -24,7 +26,7 @@ import Data.Semigroup (Semigroup (..))
2426
#endif
2527
import GHC.Generics
2628

27-
import qualified Data.Semigroup.Additive as X
29+
import qualified Data.Semigroup.Commutative as X
2830
import Data.Patch.Class as X
2931
import Data.Patch.DMap as X hiding (getDeletions)
3032
import Data.Patch.DMapWithMove as X

src/Data/Patch/MapWithPatchingMove.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ patchThatSortsMapWith cmp m = PatchMapWithPatchingMove $ Map.fromList $ catMaybe
230230
Just (from, to)
231231
reverseMapping = Map.fromList $ catMaybes $ zipWith f unsorted sorted
232232
g (to, _) (from, _) = if to == from then Nothing else
233-
let Just movingTo = Map.lookup from reverseMapping
233+
let movingTo = fromMaybe err $ Map.lookup from reverseMapping
234234
in Just (to, NodeInfo (From_Move from mempty) $ Just movingTo)
235+
err = error "IMPOSSIBLE happens in patchThatSortsMapWith"
235236

236237
-- | Create a 'PatchMapWithPatchingMove' that, if applied to the first 'Map' provided,
237238
-- will produce a 'Map' with the same values as the second 'Map' but with the

0 commit comments

Comments
 (0)