Skip to content
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

fix for GHC 9.10 #139

Merged
merged 3 commits into from
May 15, 2024
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
43 changes: 23 additions & 20 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
branches: [ main ]

jobs:
nix_build:
nix_matrix:
strategy:
matrix:
# 88 is not in nixpkgs anymore
# 910 does not build yet for unknown reason
# We are not using nix build .#pyf_all because of github disk limitations
ghc: [86, 90, 92, 94, 96, 98]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v21
Expand All @@ -19,29 +24,27 @@ jobs:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

# Builds cabal (nix)
- name: Build with all supported GHC
run: nix build .#pyf_all
- name: Build with GHC ${{ matrix.ghc }}
run: nix build .#pyf_${{ matrix.ghc }}

stack_build:
strategy:
matrix:
resolver: [ lts-14.27 # 8.6
, lts-16.31 # 8.8
, lts-17.1 # 8.10
, lts-19.1 # 9.0
, lts-20.26 # 9.2
, lts-21.17 # 9.4
, lts-22.22 # 9.6
, nightly-2024-05-15 # 9.8 nightly
]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Stack
run: sudo apt-get install haskell-stack

# Build stack
- name: Stack 9.6
run: stack --resolver nightly-2023-10-24 test
- name: Stack 9.4
run: stack --resolver lts-21.17 test
- name: Stack 9.2
run: stack --resolver lts-20.26 test
- name: Stack 9.0
run: stack --resolver lts-19.1 test
- name: Stack 8.10
run: stack --resolver lts-17.1 test
- name: Stack 8.8
run: stack --resolver lts-16.31 test
- name: Stack 8.6
run: stack --resolver lts-14.27 test
- name: Stack resolver ${{ matrix.resolver }}
run: stack --resolver ${{ matrix.resolver }} test
13 changes: 7 additions & 6 deletions flake.lock

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

51 changes: 30 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "PyF";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.nixpkgs.url = "github:nixos/nixpkgs/haskell-updates";

# Broken: see https://github.com/NixOS/nix/issues/5621
#nixConfig.allow-import-from-derivation = true;
Expand Down Expand Up @@ -45,7 +45,7 @@
++ [ hPkgs.haskell-language-server ];
});

pkg = (haskell.lib.buildFromSdist
pkg = (
(hPkgs.callCabal2nix "PyF" sources { })).overrideAttrs
(oldAttrs: {
buildInputs = oldAttrs.buildInputs;
Expand All @@ -64,9 +64,7 @@
});
});

pyf_88 = pyfBuilder (haskell.packages.ghc88.override {
overrides = self: super: with haskell.lib; { };
});
# GHC 8.8 is not in nixpkgs anymore.

pyf_810 = pyfBuilder (haskell.packages.ghc810.override {
overrides = self: super: with haskell.lib; { };
Expand Down Expand Up @@ -100,36 +98,47 @@
};
});

pyf_98 = pyfBuilder ((haskell.packages.ghc98.override {
pyf_98 = pkgs.haskell.lib.dontCheck (pyfBuilder ((haskell.packages.ghc98.override {
overrides = self: super:
with haskell.lib; {
# Bump hspec (and dependencies)
hspec-core = super.callHackage "hspec-core" "2.11.6" {};
hspec-meta = super.callHackage "hspec-meta" "2.11.6" {};
hspec = super.callHackage "hspec" "2.11.6" {};
hspec-discover = super.callHackage "hspec-discover" "2.11.6" {};
hspec-expectations = super.callHackage "hspec-expectations" "0.8.4" {};
tagged = doJailbreak super.tagged;
#hspec-core = super.callHackage "hspec-core" "2.11.6" {};
#hspec-meta = super.callHackage "hspec-meta" "2.11.6" {};
#hspec = super.callHackage "hspec" "2.11.6" {};
#hspec-discover = super.callHackage "hspec-discover" "2.11.6" {};
#hspec-expectations = super.callHackage "hspec-expectations" "0.8.4" {};
#tagged = doJailbreak super.tagged;

# Disabling tests breaks the loop with hspec
base-orphans = dontCheck super.base-orphans;
splitmix = doJailbreak super.splitmix;
## Disabling tests breaks the loop with hspec
#base-orphans = dontCheck super.base-orphans;
#splitmix = doJailbreak super.splitmix;

};
}));
})));

pyf_910 = pyfBuilder (haskell.packages.ghc910.override {
overrides = self: super: with haskell.lib; rec {
primitive = dontCheck super.primitive_0_9_0_0;
HUnit = dontCheck super.HUnit;
call-stack = dontCheck super.call-stack;
hspec-expectations = dontCheck super.hspec-expectations;
QuickCheck = dontCheck super.QuickCheck;
hspec-discover = dontCheck super.hspec-discover;
};
});

pyf_all = linkFarmFromDrvs "all_pyf" [
pyf_86
pyf_88
pyf_810
pyf_90
pyf_92
pyf_94
pyf_96

# Nix build of the different component for testing in 98 are not working
# But building with cabal works
# pyf_98
pyf_98

# https://github.com/NixOS/nixpkgs/pull/311912/files
# For some reason, nixpkgs does not build correctly with recent cabal
pyf_910
];

# Only the current build is built with python3 support
Expand Down
6 changes: 3 additions & 3 deletions src/PyF/Internal/Meta.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ toExp _ Expr.HsIPVar {} = noTH "toExp" "HsIPVar"
toExp _ (Expr.HsLit _ l) = TH.LitE (toLit l)
toExp _ (Expr.HsOverLit _ OverLit {ol_val}) = TH.LitE (toLit' ol_val)
toExp d (Expr.HsApp _ e1 e2) = TH.AppE (toExp d . unLoc $ e1) (toExp d . unLoc $ e2)
#if MIN_VERSION_ghc(9,8,0)
#if MIN_VERSION_ghc(9,10,0)
toExp d (Expr.HsAppType _ e HsWC{hswc_body}) = TH.AppTypeE (toExp d . unLoc $ e) (toType . unLoc $ hswc_body)
toExp d (Expr.ExprWithTySig _ e HsWC{hswc_body=unLoc -> HsSig{sig_body}}) = TH.SigE (toExp d . unLoc $ e) (toType . unLoc $ sig_body)
#elif MIN_VERSION_ghc(9,6,0)
Expand All @@ -180,7 +180,7 @@ toExp d (Expr.ExprWithTySig HsWC{hswc_body=HsIB{hsib_body}} e) = TH.SigE (toExp
toExp d (Expr.OpApp _ e1 o e2) = TH.UInfixE (toExp d . unLoc $ e1) (toExp d . unLoc $ o) (toExp d . unLoc $ e2)
toExp d (Expr.NegApp _ e _) = TH.AppE (TH.VarE 'negate) (toExp d . unLoc $ e)
-- NOTE: for lambda, there is only one match
#if MIN_VERSION_ghc(9,8,0)
#if MIN_VERSION_ghc(9,10,0)
toExp d (Expr.HsLam _ _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)])))) = TH.LamE (fmap (toPat d) ps) (toExp d e)
#elif MIN_VERSION_ghc(9,6,0)
toExp d (Expr.HsLam _ (Expr.MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (Expr.GRHSs _ [unLoc -> Expr.GRHS _ _ (unLoc -> e)] _)])))) = TH.LamE (fmap (toPat d) ps) (toExp d e)
Expand Down Expand Up @@ -218,7 +218,7 @@ toExp d (Expr.ExplicitTuple _ (map unLoc -> args) boxity) = ctor tupArgs
{- ORMOLU_ENABLE -}

-- toExp (Expr.List _ xs) = TH.ListE (fmap toExp xs)
#if MIN_VERSION_ghc(9,8,0)
#if MIN_VERSION_ghc(9,10,0)
toExp d (Expr.HsPar _ e) = TH.ParensE (toExp d . unLoc $ e)
#elif MIN_VERSION_ghc(9,3,0)
toExp d (Expr.HsPar _ _ e _) = TH.ParensE (toExp d . unLoc $ e)
Expand Down
2 changes: 1 addition & 1 deletion src/PyF/Internal/QQ.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ findFreeVariables item = allNames
Just (HsVar _ l) -> [l]
#endif

#if MIN_VERSION_ghc(9,8,0)
#if MIN_VERSION_ghc(9,10,0)
Just (HsLam _ _ (MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (GRHSs _ [unLoc -> GRHS _ _ (unLoc -> e)] _)])))) -> filter keepVar subVars
#elif MIN_VERSION_ghc(9,6,0)
Just (HsLam _ (MG _ (unLoc -> (map unLoc -> [Expr.Match _ _ (map unLoc -> ps) (GRHSs _ [unLoc -> GRHS _ _ (unLoc -> e)] _)])))) -> filter keepVar subVars
Expand Down
Loading