Skip to content

Commit 15737c8

Browse files
v1.3 Support GHC 9.*
1 parent b2e15ad commit 15737c8

File tree

8 files changed

+113
-56
lines changed

8 files changed

+113
-56
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 93 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,104 @@
11
# This GitHub workflow config has been generated by a script via
22
#
3-
# haskell-ci 'github' 'free-functors.cabal'
3+
# haskell-ci 'github' 'cabal.project'
44
#
55
# To regenerate the script (for example after adjusting tested-with) run
66
#
77
# haskell-ci regenerate
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.11.20210222
11+
# version: 0.19.20260104
1212
#
13-
# REGENDATA ("0.11.20210222",["github","free-functors.cabal"])
13+
# REGENDATA ("0.19.20260104",["github","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
1717
- push
1818
- pull_request
19+
- merge_group
1920
jobs:
2021
linux:
21-
name: Haskell-CI - Linux - GHC ${{ matrix.ghc }}
22-
runs-on: ubuntu-18.04
22+
name: Haskell-CI - Linux - ${{ matrix.compiler }}
23+
runs-on: ubuntu-24.04
24+
timeout-minutes:
25+
60
2326
container:
24-
image: buildpack-deps:bionic
27+
image: buildpack-deps:jammy
2528
continue-on-error: ${{ matrix.allow-failure }}
2629
strategy:
2730
matrix:
2831
include:
29-
- ghc: 9.0.1
32+
- compiler: ghc-9.14.1
33+
compilerKind: ghc
34+
compilerVersion: 9.14.1
35+
setup-method: ghcup
3036
allow-failure: false
31-
- ghc: 8.10.2
37+
- compiler: ghc-9.12.2
38+
compilerKind: ghc
39+
compilerVersion: 9.12.2
40+
setup-method: ghcup
3241
allow-failure: false
33-
- ghc: 8.8.4
42+
- compiler: ghc-9.10.3
43+
compilerKind: ghc
44+
compilerVersion: 9.10.3
45+
setup-method: ghcup
46+
allow-failure: false
47+
- compiler: ghc-9.8.4
48+
compilerKind: ghc
49+
compilerVersion: 9.8.4
50+
setup-method: ghcup
51+
allow-failure: false
52+
- compiler: ghc-9.6.7
53+
compilerKind: ghc
54+
compilerVersion: 9.6.7
55+
setup-method: ghcup
3456
allow-failure: false
3557
fail-fast: false
3658
steps:
37-
- name: apt
59+
- name: apt-get install
3860
run: |
3961
apt-get update
40-
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
41-
apt-add-repository -y 'ppa:hvr/ghc'
42-
apt-get update
43-
apt-get install -y ghc-$GHC_VERSION cabal-install-3.4
62+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
63+
- name: Install GHCup
64+
run: |
65+
mkdir -p "$HOME/.ghcup/bin"
66+
curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup"
67+
chmod a+x "$HOME/.ghcup/bin/ghcup"
68+
- name: Install cabal-install
69+
run: |
70+
"$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
71+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV"
72+
- name: Install GHC (GHCup)
73+
if: matrix.setup-method == 'ghcup'
74+
run: |
75+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
76+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
77+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
78+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
79+
echo "HC=$HC" >> "$GITHUB_ENV"
80+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
81+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
4482
env:
45-
GHC_VERSION: ${{ matrix.ghc }}
83+
HCKIND: ${{ matrix.compilerKind }}
84+
HCNAME: ${{ matrix.compiler }}
85+
HCVER: ${{ matrix.compilerVersion }}
4686
- name: Set PATH and environment variables
4787
run: |
4888
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
49-
echo "LANG=C.UTF-8" >> $GITHUB_ENV
50-
echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV
51-
echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV
52-
HC=/opt/ghc/$GHC_VERSION/bin/ghc
53-
echo "HC=$HC" >> $GITHUB_ENV
54-
echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV
55-
echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV
56-
echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
89+
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
90+
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
91+
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
5792
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
58-
echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV
59-
echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV
60-
echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV
61-
echo "HEADHACKAGE=false" >> $GITHUB_ENV
62-
echo "ARG_COMPILER=--ghc --with-compiler=$HC" >> $GITHUB_ENV
63-
echo "GHCJSARITH=0" >> $GITHUB_ENV
93+
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
94+
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
95+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
96+
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
97+
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
6498
env:
65-
GHC_VERSION: ${{ matrix.ghc }}
99+
HCKIND: ${{ matrix.compilerKind }}
100+
HCNAME: ${{ matrix.compiler }}
101+
HCVER: ${{ matrix.compilerVersion }}
66102
- name: env
67103
run: |
68104
env
@@ -85,6 +121,10 @@ jobs:
85121
repository hackage.haskell.org
86122
url: http://hackage.haskell.org/
87123
EOF
124+
cat >> $CABAL_CONFIG <<EOF
125+
program-default-options
126+
ghc-options: $GHCJOBS +RTS -M3G -RTS
127+
EOF
88128
cat $CABAL_CONFIG
89129
- name: versions
90130
run: |
@@ -97,14 +137,14 @@ jobs:
97137
- name: install cabal-plan
98138
run: |
99139
mkdir -p $HOME/.cabal/bin
100-
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
101-
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
140+
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
141+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
102142
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
103143
rm -f cabal-plan.xz
104144
chmod a+x $HOME/.cabal/bin/cabal-plan
105145
cabal-plan --version
106146
- name: checkout
107-
uses: actions/checkout@v2
147+
uses: actions/checkout@v5
108148
with:
109149
path: source
110150
- name: initial cabal.project for sdist
@@ -123,27 +163,33 @@ jobs:
123163
- name: generate cabal.project
124164
run: |
125165
PKGDIR_free_functors="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/free-functors-[0-9.]*')"
126-
echo "PKGDIR_free_functors=${PKGDIR_free_functors}" >> $GITHUB_ENV
166+
echo "PKGDIR_free_functors=${PKGDIR_free_functors}" >> "$GITHUB_ENV"
167+
rm -f cabal.project cabal.project.local
127168
touch cabal.project
128169
touch cabal.project.local
129170
echo "packages: ${PKGDIR_free_functors}" >> cabal.project
130171
echo "package free-functors" >> cabal.project
131-
echo " ghc-options: -Werror=missing-methods" >> cabal.project
172+
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
173+
echo "package free-functors" >> cabal.project
174+
echo " ghc-options: -Werror=unused-packages" >> cabal.project
175+
echo "package free-functors" >> cabal.project
176+
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
132177
cat >> cabal.project <<EOF
178+
allow-newer: indexed-traversable:*
133179
EOF
134-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(free-functors)$/; }' >> cabal.project.local
180+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(free-functors)$/; }' >> cabal.project.local
135181
cat cabal.project
136182
cat cabal.project.local
137183
- name: dump install plan
138184
run: |
139185
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
140186
cabal-plan
141-
- name: cache
142-
uses: actions/cache@v2
187+
- name: restore cache
188+
uses: actions/cache/restore@v4
143189
with:
144-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }}
190+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
145191
path: ~/.cabal/store
146-
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
192+
restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
147193
- name: install dependencies
148194
run: |
149195
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
@@ -160,8 +206,14 @@ jobs:
160206
${CABAL} -vnormal check
161207
- name: haddock
162208
run: |
163-
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
209+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
164210
- name: unconstrained build
165211
run: |
166212
rm -f cabal.project.local
167213
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
214+
- name: save cache
215+
if: always()
216+
uses: actions/cache/save@v4
217+
with:
218+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
219+
path: ~/.cabal/store

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
dist-newstyle
2-
cabal.project

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
CHANGELOG
2+
1.2 -> 1.3
3+
- Add support for GHC 9.6 through 9.14
4+
- Update to derive-lifted-instances v0.3
25

36
1.1.2 -> 1.2
47
- Add support for GHC 9.0, drop GHC 8.8

cabal.project

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages: .
2+
3+
allow-newer:
4+
indexed-traversable:*

free-functors.cabal

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: free-functors
2-
version: 1.2.1
2+
version: 1.3
33
synopsis: Free functors, adjoint to functors that forget class constraints.
44
description: A free functor is a left adjoint to a forgetful functor. It used to be the case
55
that the only category that was easy to work with in Haskell was Hask itself, so
@@ -21,15 +21,17 @@ homepage: https://github.com/sjoerdvisscher/free-functors
2121
bug-reports: https://github.com/sjoerdvisscher/free-functors/issues
2222

2323
build-type: Simple
24-
cabal-version: >= 1.10
25-
tested-with: GHC==9.0.1, GHC==8.10.2, GHC==8.8.4
24+
cabal-version: 2.0
25+
tested-with: GHC==9.6.7, GHC==9.8.4, GHC==9.10.3, GHC==9.12.2, GHC==9.14.1
2626

2727
extra-source-files:
2828
examples/*.hs
29+
30+
extra-doc-files:
2931
CHANGELOG
3032

3133
Library
32-
HS-Source-Dirs:
34+
hs-source-dirs:
3335
src
3436

3537
exposed-modules:
@@ -46,16 +48,16 @@ Library
4648
Haskell2010
4749

4850
build-depends:
49-
base >= 4.13 && < 4.16,
50-
template-haskell >= 2.15 && < 2.18,
51-
transformers == 0.5.*,
51+
base >= 4.18 && < 4.23,
52+
template-haskell >= 2.20 && < 2.25,
53+
transformers >= 0.5 && < 0.7,
5254
comonad == 5.*,
53-
derive-lifted-instances >= 0.2.2 && < 0.3,
55+
derive-lifted-instances == 0.3.*,
5456
contravariant == 1.5.*,
5557
bifunctors == 5.*,
5658
profunctors == 5.*
5759

5860

5961
source-repository head
6062
type: git
61-
location: git://github.com/sjoerdvisscher/free-functors.git
63+
location: https://github.com/sjoerdvisscher/free-functors

src/Data/Functor/Cofree/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cofreeDeriv cofree = idDeriv {
4040
cst = \e -> [| const $e $kExp |], -- Suppress "Defined but not used: ‘k’" warning
4141
res = \e -> [| $(pure (ConE cofree)) $kExp $e |],
4242
eff = \e -> [| $(pure (ConE cofree)) $kExp <$> $e |],
43-
inp = fmap (\vp -> ConP cofree [kPat, vp])
43+
inp = fmap (\vp -> ConP cofree [] [kPat, vp])
4444
}
4545

4646
deriveCofreeInstance' :: Name -> Name -> Name -> Q [Dec]

src/Data/Functor/Free.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-unused-matches #-}
1+
{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-unused-matches -Wno-noncanonical-monoid-instances#-}
22
{-# LANGUAGE
33
RankNTypes
44
, TypeFamilies
@@ -100,7 +100,6 @@ instance Applicative (Free c) where
100100
fs <*> as = transform (\k f -> rightAdjunct (k . f) as) fs
101101

102102
instance Monad (Free c) where
103-
return = unit
104103
as >>= f = transform (\k -> rightAdjunct k . f) as
105104

106105
instance (forall f x. Applicative f => c (Ap f (Free c x))) => Foldable (Free c) where

src/Data/Functor/HFree.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ newtype HFree c f a = HFree { runHFree :: forall g. c g => (f :~> g) -> g a }
4545
instance (c ~=> Monad, c (HFree c f)) => Monad (HFree c f) where
4646
return = pure
4747
HFree f >>= g = HFree $ \k -> f k >>= rightAdjunct k . g
48-
HFree f >> HFree g = HFree $ \k -> f k >> g k
49-
5048

5149
-- | Derive the instance of @`HFree` c f a@ for the class @c@,.
5250
--

0 commit comments

Comments
 (0)