Skip to content

Commit

Permalink
Fix CI, silence mappend warnings (#202)
Browse files Browse the repository at this point in the history
* Update dependencies

* Pacify warnings: define `mappend` canonically as `(<>)`

* CI: update caching logic, add tests
  • Loading branch information
andreasabel authored Nov 1, 2023
1 parent 70fbdcf commit 0600b44
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 25 deletions.
53 changes: 38 additions & 15 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,57 @@
name: Haskell CI
name: Haskell

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1.2
- name: Cache
uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup
# Default options, written out for clarity:
with:
ghc-version: latest
cabal-update: true

- name: Configure build
run: |
cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=always
cabal build --dry-run
# The latter creates the build plan in dist-newstyle/cache/plan.json

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

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
cabal update
cabal build --only-dependencies --enable-tests --enable-benchmarks
cabal build --only-dependencies
- name: Cache dependencies
uses: actions/cache/save@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ~/.cabal
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
run: cabal build --enable-tests --enable-benchmarks all
run: |
cabal build all
- name: Test
run: |
cabal test all
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ would find useful.

## Development Status

[![Build Status](https://travis-ci.org/Gabriella439/Haskell-Foldl-Library.png)](https://travis-ci.org/Gabriella439/Haskell-Foldl-Library)
[![Build Status](https://github.com/Gabriella439/foldl/actions/workflows/haskell.yml/badge.svg)](https://github.com/Gabriella439/foldl/actions/workflows/haskell.yml)

The `foldl` library is pretty stable at this point. I don't expect there to be
breaking changes to the API from this point forward unless people discover new
Expand Down
8 changes: 4 additions & 4 deletions foldl.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Library
HS-Source-Dirs: src
Build-Depends:
base >= 4.11.0.0 && < 5 ,
bytestring >= 0.9.2.1 && < 0.12,
bytestring >= 0.9.2.1 && < 0.13,
random >= 1.2 && < 1.3 ,
primitive < 0.9 ,
text >= 0.11.2.0 && < 2.1 ,
primitive < 0.10,
text >= 0.11.2.0 && < 2.2 ,
transformers >= 0.2.0.0 && < 0.7 ,
vector >= 0.7 && < 0.14,
containers >= 0.5.0.0 && < 0.7 ,
containers >= 0.5.0.0 && < 0.8 ,
unordered-containers < 0.3 ,
hashable < 1.5 ,
contravariant < 1.6 ,
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Foldl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ instance Monoid b => Monoid (Fold a b) where
mempty = pure mempty
{-# INLINE mempty #-}

mappend = liftA2 mappend
mappend = (<>)
{-# INLINE mappend #-}

instance Num b => Num (Fold a b) where
Expand Down Expand Up @@ -434,7 +434,7 @@ instance (Monoid b, Monad m) => Monoid (FoldM m a b) where
mempty = pure mempty
{-# INLINE mempty #-}

mappend = liftA2 mappend
mappend = (<>)
{-# INLINE mappend #-}

instance (Monad m, Num b) => Num (FoldM m a b) where
Expand Down
2 changes: 1 addition & 1 deletion src/Control/Foldl/NonEmpty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ instance Monoid b => Monoid (Fold1 a b) where
mempty = pure mempty
{-# INLINE mempty #-}

mappend = liftA2 mappend
mappend = (<>)
{-# INLINE mappend #-}

instance Num b => Num (Fold1 a b) where
Expand Down
4 changes: 2 additions & 2 deletions src/Control/Scanl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ instance Monoid b => Monoid (Scan a b) where
mempty = pure mempty
{-# INLINE mempty #-}

mappend = liftA2 mappend
mappend = (<>)
{-# INLINE mappend #-}

instance Num b => Num (Scan a b) where
Expand Down Expand Up @@ -299,7 +299,7 @@ instance (Monad m, Monoid b) => Monoid (ScanM m a b) where
mempty = pure mempty
{-# INLINE mempty #-}

mappend = liftA2 mappend
mappend = (<>)
{-# INLINE mappend #-}

instance (Monad m, Num b) => Num (ScanM m a b) where
Expand Down

0 comments on commit 0600b44

Please sign in to comment.