Skip to content

Commit

Permalink
Make it build with ghc-9.8 (IntersectMBO#5564)
Browse files Browse the repository at this point in the history
* Make it build with ghc-9.8

* Add 9.8 CI

* Fix TH version conditional

* invert conditional

* Add constraints for inline-r

* Fixup shell for GHC 9.8

* Make it build with ghc-9.8

* bump chap

* Disable plugin stuff on 9.8

* More version conditionals

* Deal with some warnings

* Try this instead

* cabal.project: Bump index states

* Facepalm

* Weirdly enormous stylish-haskell diff

* Fix rebase

* Cabal-fmt

* Somehow more stylish-haskell

* cabal.project: Updates

* Fix shell and revert stylish-haskell changes

* bump flake

* Update contributing

---------

Co-authored-by: Michael Peyton Jones <[email protected]>
  • Loading branch information
erikd and michaelpj authored Nov 27, 2023
1 parent d59a047 commit f0bf600
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 22 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Supported versions older than the primary development version are deprecated, an
At the moment, our supported GHC versions are:
- 8.10 (deprecated)
- 9.6 (primary)
- 9.8

=== Plugin support

Expand Down
34 changes: 32 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ repository cardano-haskell-packages
-- update either of these.
index-state:
-- Bump both the following dates if you need newer packages from Hackage
, hackage.haskell.org 2023-11-08T00:00:00Z
, hackage.haskell.org 2023-11-26T21:52:49Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2023-11-08T00:00:00Z
, cardano-haskell-packages 2023-11-26T20:12:16Z

packages: doc/read-the-docs-site
plutus-benchmark
Expand Down Expand Up @@ -70,3 +70,33 @@ source-repository-package
type: git
location: https://github.com/jaccokrijnen/plutus-cert
tag: e814b9171398cbdfecdc6823067156a7e9fc76a3

if impl(ghc >= 9.8)
allow-newer:
-- https://github.com/aisamanra/config-ini/pull/50
, config-ini:containers

-- https://github.com/haskell-unordered-containers/hashable/pull/289
, hashable:containers

-- https://github.com/typeclasses/hex-text/pull/8
, hex-text:base
, hex-text:bytestring
, hex-text:text

-- https://github.com/tweag/HaskellR/pull/420
, inline-r:singletons-th
, inline-r:aeson
, inline-r:text
, inline-r:template-haskell
, inline-r:deepseq
, inline-r:bytestring
, inline-r:containers
, inline-r:primitive

constraints:
, brick >= 1.10
, th-abstraction >= 0.6.0.0
, text >= 2.1
, foldl >= 1.4
, vty >= 6.0
2 changes: 1 addition & 1 deletion doc/read-the-docs-site/plutus-doc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ common lang

common ghc-version-support
-- See the section on GHC versions in CONTRIBUTING
if impl(ghc <9.6)
if (impl(ghc <9.6) || impl(ghc >9.6))
buildable: False

executable doc-doctests
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

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

7 changes: 7 additions & 0 deletions nix/outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
ghc96-mingwW64 = project.variants.ghc96.cross.mingwW64;
ghc96-musl64 = project.variants.ghc96.cross.musl64;
ghc96-profiled = project.variants.ghc96-profiled;
ghc98 = project.variants.ghc98;
ghc810 = project.variants.ghc810;

in
Expand All @@ -19,6 +20,7 @@ in
devShells.profiled = ghc96-profiled.devShell;
devShells.ghc96 = ghc96.devShell;
devShells.ghc810 = ghc810.devShell;
devShells.ghc98 = ghc98.devShell;

packages = ghc96.packages;
apps = ghc96.apps;
Expand All @@ -42,6 +44,7 @@ in

hydraJobs.ghc96 = ghc96.hydraJobs;
hydraJobs.ghc810 = ghc810.hydraJobs;
hydraJobs.ghc98 = ghc98.hydraJobs;
})

(lib.optionalAttrs (system == "x86_64-linux")
Expand All @@ -67,11 +70,15 @@ in
# because of https://github.com/well-typed/cborg/issues/311
hydraJobs.ghc810.devShell = ghc810.devShell;
hydraJobs.ghc96.devShell = ghc96.devShell;
hydraJobs.ghc98.devShell = ghc98.devShell;

hydraJobs.ghc810.roots = ghc810.hydraJobs.roots;
hydraJobs.ghc810.plan-nix = ghc810.hydraJobs.plan-nix;

hydraJobs.ghc96.roots = ghc96.hydraJobs.roots;
hydraJobs.ghc96.plan-nix = ghc96.hydraJobs.plan-nix;

hydraJobs.ghc98.roots = ghc98.hydraJobs.roots;
hydraJobs.ghc98.plan-nix = ghc98.hydraJobs.plan-nix;
})
]
1 change: 1 addition & 0 deletions nix/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ let
enableLibraryProfiling = true;
}];
ghc810.compiler-nix-name = "ghc810";
ghc98.compiler-nix-name = "ghc98";
};

inputMap = { "https://input-output-hk.github.io/cardano-haskell-packages" = inputs.iogx.inputs.CHaP; };
Expand Down
18 changes: 17 additions & 1 deletion nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ cabalProject:

let

compiler-nix-name = cabalProject.args.compiler-nix-name;
isGhc98 = builtins.trace compiler-nix-name (lib.hasPrefix "ghc98" compiler-nix-name);

# We need some environment variables from the various ocaml and coq pacakges
# that the certifier code needs.
# Devshell doesn't run setup hooks from other packages, so just extract
Expand Down Expand Up @@ -55,6 +58,17 @@ in
pkgs.curl
];

# Current HLS doesn't build on 9.8, see https://github.com/input-output-hk/iogx/issues/25
# This other stuff all depends on HLS.
# FIXME: This is insanely broken somehow. I don't think the module merging is working properly.
# There is no way to turn off HLS, so I set it to be git. Nonetheless, we somehow end up with
# a HLS in the 9.8 shell... but a HLS compiled for 9.6.
tools.haskell-language-server-wrapper =
lib.mkIf (builtins.trace isGhc98 isGhc98) (lib.mkForce pkgs.git);
tools.haskell-language-server = lib.mkIf isGhc98 (lib.mkForce pkgs.git);
tools.cabal-install = lib.mkIf isGhc98 (lib.mkForce pkgs.git);
tools.stylish-haskell = lib.mkIf isGhc98 (lib.mkForce pkgs.git);
tools.hlint = lib.mkIf isGhc98 (lib.mkForce pkgs.git);

scripts.assemble-changelog = {
description = "Assembles the changelog for PACKAGE at VERSION";
Expand All @@ -81,7 +95,9 @@ in
'';

preCommit = {
stylish-haskell.enable = true;
# can't do stylish-haskell pre-commit if we don't
# have stylish-haskell
stylish-haskell.enable = !isGhc98;
cabal-fmt.enable = true;
shellcheck.enable = false;
editorconfig-checker.enable = true;
Expand Down
4 changes: 2 additions & 2 deletions plutus-benchmark/plutus-benchmark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ common lang

common ghc-version-support
-- See the section on GHC versions in CONTRIBUTING
if impl(ghc <9.6)
if (impl(ghc <9.6) || impl(ghc >9.6))
buildable: False

---------------- Common code for benchmarking ----------------
Expand Down Expand Up @@ -476,7 +476,7 @@ library marlowe-internal
build-depends:
, base
, bytestring
, cardano-crypto-class >=2.0.0.1 && <2.2
, cardano-crypto-class >=2.0.0.1 && <2.3
, directory
, filepath
, mtl
Expand Down
6 changes: 6 additions & 0 deletions plutus-core/index-envs/src/Data/RandomAccessList/Class.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
Expand All @@ -10,7 +11,12 @@ module Data.RandomAccessList.Class

import Data.Kind
import Data.List qualified as List
#if MIN_VERSION_base(4,19,0)
-- Avoid a compiler warning about unused package `extra`.
import Data.List.Extra ()
#else
import Data.List.Extra qualified as List
#endif
import Data.Maybe (fromJust, fromMaybe)
import Data.RAList qualified as RAL
import Data.Vector.NonEmpty qualified as NEV
Expand Down
3 changes: 3 additions & 0 deletions plutus-core/plutus-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ common lang
-Wincomplete-record-updates -Wredundant-constraints -Widentities
-Wunused-packages -Wmissing-deriving-strategies

if impl(ghc >=9.8)
ghc-options: -Wno-x-partial

-- This contains UPLC+TPLC, PIR must be explicitly included by depending
-- on the public sub-library.
-- In due course UPLC and TPLC should be split, with the main library
Expand Down
11 changes: 6 additions & 5 deletions plutus-ledger-api/plutus-ledger-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ common lang
-fno-ignore-interface-pragmas -fno-omit-interface-pragmas
-fno-strictness

common ghc-version-support
-- See the section on GHC versions in CONTRIBUTING
if (impl(ghc <9.6) || impl(ghc >9.6))
buildable: False

library
import: lang
hs-source-dirs: src
Expand Down Expand Up @@ -170,11 +175,7 @@ test-suite plutus-ledger-api-test
-- GHC (a requirement imposed by @cardano-node@) and while its tests don't have to, we don't want to
-- give up on all @plutus-ledger-api@ tests for older versions of GHC.
test-suite plutus-ledger-api-plugin-test
import: lang

if impl(ghc <9.6)
buildable: False

import: lang, ghc-version-support
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test-plugin
Expand Down
2 changes: 1 addition & 1 deletion plutus-tx-plugin/plutus-tx-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ common lang

common ghc-version-support
-- See the section on GHC versions in CONTRIBUTING
if impl(ghc <9.6)
if (impl(ghc <9.6) || impl(ghc >9.6))
buildable: False

flag use-ghc-stub
Expand Down
8 changes: 7 additions & 1 deletion plutus-tx/src/PlutusTx/AsData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ asDataFor dec = do
-- The newtype declaration
let ntD =
let con = TH.NormalC cname [(TH.Bang TH.NoSourceUnpackedness TH.NoSourceStrictness, TH.ConT ''BuiltinData)]
in TH.NewtypeD [] name tTypeVars Nothing con derivs
in TH.NewtypeD [] name
#if MIN_VERSION_template_haskell(2,21,0)
(TH.changeTVFlags TH.BndrReq tTypeVars)
#else
tTypeVars
#endif
Nothing con derivs

-- The pattern synonyms, one for each constructor
pats <- ifor cons $ \conIx (TH.ConstructorInfo{TH.constructorName=conName, TH.constructorFields=fields, TH.constructorVariant=cVariant}) -> do
Expand Down

0 comments on commit f0bf600

Please sign in to comment.