Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
[feat] update for compatibility with ghc 9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoIV committed Sep 10, 2024
1 parent 5e0cad1 commit d47538c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use flake -Lv
use flake .#ghc98 -Lv
3 changes: 2 additions & 1 deletion .github/workflows/test-flake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix flake check -Lv --allow-import-from-derivation --fallback --accept-flake-config
- run: nix build .#transitive-anns -Lv --fallback --accept-flake-config
- run: nix build .#ghc96-transitive-anns -Lv --fallback --accept-flake-config
- run: nix build .#ghc98-transitive-anns -Lv --fallback --accept-flake-config
- run: nix build .#ghc94-transitive-anns -Lv --fallback --accept-flake-config
- run: nix build .#ghc92-transitive-anns -Lv --fallback --accept-flake-config
46 changes: 23 additions & 23 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,19 @@
};

haskellProjects.ghc92 = {
packages = {};
settings = {};
basePackages = pkgs.haskell.packages.ghc92;
devShell.mkShellArgs.shellHook = config.pre-commit.installationScript;
};

haskellProjects.ghc94 = {
packages = {};
settings = {};
basePackages = pkgs.haskell.packages.ghc94;
devShell.mkShellArgs.shellHook = config.pre-commit.installationScript;
};
haskellProjects.default = {
packages = {};
settings = {};
basePackages = pkgs.haskellPackages;
haskellProjects.ghc96 = {
basePackages = pkgs.haskell.packages.ghc96;
devShell.mkShellArgs.shellHook = config.pre-commit.installationScript;
};
haskellProjects.ghc98 = {
basePackages = pkgs.haskell.packages.ghc98;
devShell.mkShellArgs.shellHook = config.pre-commit.installationScript;
};
};
Expand Down
8 changes: 8 additions & 0 deletions src/TransitiveAnns/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ transitiveAnnEnv annenv binds =
-- | Determine if the given constraint is of the given class.
findWanted :: Class -> Ct -> Maybe Ct
findWanted c ct = do
#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0)
let p = ctev_pred $ ctEvidence ct
#else
let p = ctev_pred $ cc_ev ct
#endif
splitTyConApp_maybe p >>= \(x, _) ->
if x == classTyCon c then Just ct else Nothing

Expand Down Expand Up @@ -213,7 +217,11 @@ solveKnownAnns tad known = do
-- that we will install during the core plugin.
solveAddAnn :: TransitiveAnnsData -> Ct -> TcPluginM [(EvTerm, Ct)]
solveAddAnn tad to_add
#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0)
| Just ann <- parsePromotedAnn tad $ ctev_pred $ ctEvidence to_add
#else
| Just ann <- parsePromotedAnn tad $ ctev_pred $ cc_ev to_add
#endif
= do
decs <- unsafeTcPluginTcM $ tcg_binds <$> getGblEnv
Just dec <- pure $ fmap fst $ getDec decs $ location to_add
Expand Down

0 comments on commit d47538c

Please sign in to comment.