Skip to content

Compatibility with GHC 9.0 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: cache-${{ runner.os }}-${{ hashFiles('nixpkgs.nix') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ hashFiles('nixpkgs.nix') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}-
key: cache-${{ runner.os }}-${{ hashFiles('nixpkgs.nix') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('capability.cabal') }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ hashFiles('nixpkgs.nix') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('capability.cabal') }}-
- name: Update Cabal's database
run: $NIXSHELL --run "cabal update"
- name: Build Cabal's dependencies
Expand All @@ -35,3 +35,18 @@ jobs:
run: $NIXSHELL --run "cabal --flag=dev test"
- name: Haddock
run: $NIXSHELL --run "cabal haddock"

stack-ghc9:
name: Build on GHC 9.0
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Cache dependencies
uses: actions/[email protected]
with:
path: ~/.stack
key: stack-ghc9-${{ runner.os }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack-ghc9.yaml.lock', 'capability.cabal') }}
- name: Upgrade stack
run: stack upgrade
- name: Build
run: stack --stack-yaml=stack-ghc9.yaml build --pedantic --test --bench --no-run-tests --no-run-benchmarks
2 changes: 0 additions & 2 deletions capability.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ library
Capability.Stream
Capability.TypeOf
Capability.Writer
Capability.Writer.Discouraged
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module is also referenced here. I think that paragraph can be removed now, given that Capability.Writer.Discouraged was the only such discouraged module.

build-depends:
base >= 4.14 && < 5.0
, constraints >= 0.1 && < 0.14
Expand All @@ -67,7 +66,6 @@ library
, generic-lens >= 2.0 && < 2.2
, lens >= 4.16 && < 5.1
, monad-control >= 1.0 && < 1.1
, monad-unlift >= 0.2 && < 0.3
, mtl >= 2.0 && < 3.0
, mutable-containers >= 0.3 && < 0.4
, primitive >= 0.6 && < 0.8
Expand Down
5 changes: 0 additions & 5 deletions src/Capability.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@
-- The use of tags allows one to have independent effects that share a superclass.
-- E.g. @HasState "foo" Int@ and @HasWriter "bar" String@.
--
-- Some of the capability modules have a “discouraged” companion (such as
-- "Capability.Writer.Discouraged"). These modules contain deriving-via
-- combinators which you can use if you absolutely must: they are correct, but
-- inefficient, so we recommend that you do not.
--
-- Finally there are
--
-- * "Capability.Derive"
Expand Down
4 changes: 2 additions & 2 deletions src/Capability/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ wrapError :: forall innertag t (cs :: [Capability]) inner m a.
, HasCatch innertag inner (t m)
, All cs m)
=> (forall m'. All (HasCatch innertag inner ': cs) m' => m' a) -> m a
wrapError =
derive @t @'[HasCatch innertag inner] @cs
wrapError action =
derive @t @'[HasCatch innertag inner] @cs action
{-# INLINE wrapError #-}

-- XXX: Does it make sense to add a HasMask capability similar to @MonadMask@?
Expand Down
4 changes: 2 additions & 2 deletions src/Capability/Reader/Internal/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ magnify :: forall innertag t (cs :: [Capability]) inner m a.
, HasReader innertag inner (t m)
, All cs m)
=> (forall m'. All (HasReader innertag inner ': cs) m' => m' a) -> m a
magnify =
derive @t @'[HasReader innertag inner] @cs
magnify action =
derive @t @'[HasReader innertag inner] @cs action
{-# INLINE magnify #-}

--------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Capability/Reflection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interpret_ ::
Reified tag c m ->
(forall m'. c m' => m' a) ->
m a
interpret_ = interpret @tag @'[] @c
interpret_ dict action = interpret @tag @'[] @c dict action
{-# INLINE interpret_ #-}

-- | @interpret \@tag \@ambient dict action@
Expand Down
4 changes: 2 additions & 2 deletions src/Capability/State/Internal/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ zoom :: forall innertag t (cs :: [Capability]) inner m a.
, HasState innertag inner (t m)
, All cs m )
=> (forall m'. All (HasState innertag inner ': cs) m' => m' a) -> m a
zoom =
derive @t @'[HasState innertag inner] @cs
zoom action =
derive @t @'[HasState innertag inner] @cs action
{-# INLINE zoom #-}

--------------------------------------------------------------------------------
Expand Down
55 changes: 0 additions & 55 deletions src/Capability/Writer/Discouraged.hs

This file was deleted.

12 changes: 12 additions & 0 deletions stack-ghc9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resolver: nightly-2021-07-04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test this configuration on CI?


packages:
- .

extra-deps:
# Generic-lens is not yet released in a 9.0-compatible version
- git: https://github.com/kcsongor/generic-lens.git
commit: 8e1fc7dcf444332c474fca17110d4bc554db08c8
subdirs:
- generic-lens-core
- generic-lens
38 changes: 38 additions & 0 deletions stack-ghc9.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
subdir: generic-lens-core
name: generic-lens-core
version: 2.1.0.0
git: https://github.com/kcsongor/generic-lens.git
pantry-tree:
size: 2283
sha256: 5a26b16c38ad8d8ebc81182e1d09858858f16dc117a0c7b084d8446d3a17d749
commit: 8e1fc7dcf444332c474fca17110d4bc554db08c8
original:
subdir: generic-lens-core
git: https://github.com/kcsongor/generic-lens.git
commit: 8e1fc7dcf444332c474fca17110d4bc554db08c8
- completed:
subdir: generic-lens
name: generic-lens
version: 2.1.0.0
git: https://github.com/kcsongor/generic-lens.git
pantry-tree:
size: 2630
sha256: aba81557550537d4cfda2c1b07accff8589da44a1e418a3cde5639eb438d1c86
commit: 8e1fc7dcf444332c474fca17110d4bc554db08c8
original:
subdir: generic-lens
git: https://github.com/kcsongor/generic-lens.git
commit: 8e1fc7dcf444332c474fca17110d4bc554db08c8
snapshots:
- completed:
size: 540164
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2021/7/4.yaml
sha256: 195e3e9394de03e724525e210f82e30c4488f7c8a09fc70850d75d8b79332993
original: nightly-2021-07-04