Skip to content

Commit

Permalink
build with 9.10.1. Clean warnings and upd CI
Browse files Browse the repository at this point in the history
  • Loading branch information
odr committed Jun 8, 2024
1 parent 625ecd5 commit 88b326e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 31 deletions.
69 changes: 46 additions & 23 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,61 @@ jobs:
strategy:
fail-fast: false
matrix:
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']
os: ['ubuntu-latest', 'macos-latest']
ghc: ['8.6', '8.10', '9.4', '9.6', '9.8', '9.10']
os: ['ubuntu-latest']
include:
- ghc: '9.10'
os: 'macos-latest'
runs-on: ${{ matrix.os }}

name: GHC ${{ matrix.ghc }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
- uses: actions/checkout@v4

- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.10.1.0'
- name: Cache
uses: actions/cache@v3

- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --enable-documentation
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.

- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
cache-name: cache-cabal
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ~/.cabal
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.ghc }}-build-
${{ runner.os }}-${{ matrix.ghc }}-
${{ runner.os }}
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-

- name: Install dependencies
run: cabal build --only-dependencies --enable-tests --enable-benchmarks
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies

# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
run: cabal build --enable-tests --enable-benchmarks all
run: cabal build all

- name: Run tests
# 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.
run: cabal test --enable-tests -f-hlint all
- if: matrix.ghc != '8.4.4'
# docs aren't built on ghc 8.4.4 because some dependency docs don't build on older GHCs
name: Build Docs
run: cabal haddock
run: cabal test all

- name: Check cabal file
run: cabal check

- name: Build documentation
run: cabal haddock all
12 changes: 6 additions & 6 deletions patch.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ flag hlint
library
hs-source-dirs: src
default-language: Haskell2010
build-depends: base >= 4.9 && < 4.19
build-depends: base >= 4.9 && < 4.21
, constraints-extras >= 0.3 && < 0.5
, commutative-semigroups >= 0.0 && < 0.2
, containers >= 0.6 && < 0.7
, commutative-semigroups >= 0.0 && < 0.3
, containers >= 0.6 && < 0.8
, dependent-map >= 0.3 && < 0.5
, dependent-sum >= 0.6 && < 0.8
, lens >= 4.7 && < 5.3
, lens >= 4.7 && < 5.4
, indexed-traversable >= 0.1 && < 0.2
, semigroupoids >= 4.0 && < 7
, transformers >= 0.5.6.0 && < 0.7
, witherable >= 0.3 && < 0.5
, witherable >= 0.3 && < 0.6

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

ghc-options: -Wall -fwarn-redundant-constraints -fwarn-tabs
default-extensions: PolyKinds
default-extensions: PolyKinds, TypeOperators

if flag(split-these)
build-depends: these >= 1 && <1.3
Expand Down
4 changes: 3 additions & 1 deletion src/Data/Patch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module Data.Patch
) where

import Data.Semigroup.Commutative
#if !MIN_VERSION_base(4,18,0)
import Control.Applicative (liftA2)
#endif
import Data.Functor.Const (Const (..))
import Data.Functor.Identity
import Data.Map.Monoidal (MonoidalMap)
Expand All @@ -24,7 +26,7 @@ import Data.Semigroup (Semigroup (..))
#endif
import GHC.Generics

import qualified Data.Semigroup.Additive as X
import qualified Data.Semigroup.Commutative as X
import Data.Patch.Class as X
import Data.Patch.DMap as X hiding (getDeletions)
import Data.Patch.DMapWithMove as X
Expand Down
3 changes: 2 additions & 1 deletion src/Data/Patch/MapWithPatchingMove.hs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ patchThatSortsMapWith cmp m = PatchMapWithPatchingMove $ Map.fromList $ catMaybe
Just (from, to)
reverseMapping = Map.fromList $ catMaybes $ zipWith f unsorted sorted
g (to, _) (from, _) = if to == from then Nothing else
let Just movingTo = Map.lookup from reverseMapping
let movingTo = fromMaybe err $ Map.lookup from reverseMapping
in Just (to, NodeInfo (From_Move from mempty) $ Just movingTo)
err = error "IMPOSSIBLE happens in patchThatSortsMapWith"

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

0 comments on commit 88b326e

Please sign in to comment.