Skip to content

Commit

Permalink
Make it build with ghc-9.6 (#5286)
Browse files Browse the repository at this point in the history
* WIP Make it build with ghc-9.6

Co-Authored-By: effectfully <effectfully@gmail.com>

* 9.6 CI

Add GHC 9.6 to our CI.

* Bump cabal-install to support newer GHCs

* Relax bound for inline-r

* Un-conditionalize s-r-p, setup sha256map

* Bump cardano-crypto-class bound

* Only build 9.6 on linux for now

* Simplify allow-newers

* Fix warnings

* more

* Don't build the 9.6 shell on aarch64-darwin either

* Fix nothunks for MachineParameters

* Make it build with ghc-9.6

Co-Authored-By: effectfully <effectfully@gmail.com>

---------

Co-authored-by: effectfully <effectfully@gmail.com>
Co-authored-by: Michael Peyton Jones <michael.peyton-jones@iohk.io>
  • Loading branch information
3 people authored May 18, 2023
1 parent 0fb408f commit ab4d2cc
Show file tree
Hide file tree
Showing 101 changed files with 349 additions and 159 deletions.
26 changes: 16 additions & 10 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,26 @@ There are various tools for visualizing the resulting profile, e.g. https://hack

== GHC versions

=== 9.2 migration
We have a set of supported GHC major versions, which are built in CI and which we commit to keeping working.

We are in the process of moving to 9.2 from 8.10.
We have now primarily moved to 9.2, with 8.10 being kept as a backup.
We have CI for both versions, although a few packages only build on 9.2 (notably the plugin and it's dependents).
The ones that do not build on 8.10 are explicitly marked as unbuildable in the cabal files.
We also have a primary development version.
This is the version we use in the default dev shell, and also it is the _only_ version for which we support `plutus-tx-plugin`.
The plugin and its dependents should be marked as unbuildable with cabal conditionals on all other major GHC versions.

We will drop 8.10 once there is a released Cardano node using 9.2.
Until then all our code must continue to build with both, so you cannot use any 9.2-only features yet.
The primary development version should be whichever version the Cardano node is using (or migrating towards using).
Supported versions older than the primary development version are deprecated, and we can drop them as soon as the Cardano node has moved to a later GHC version.

The default devshell is a 9.2 shell, but you can get an 8.10 devshell with `nix develop .#plutus-shell-8107`.
At the moment, our supported GHC versions are:
- 8.10 (deprecated)
- 9.2 (primary)
- 9.6

NOTE: The dev tools in the 8.10 shell will still be built with 9.2, so some things like HLS may not work properly.
Do not use the 8.10 shell for anything except fixing compatibility problems.
=== Per-version tooling

We have a dev shell for each supported GHC version which you can use if you need to fix issues on that specific version.
You can access them like this: `nix develop .#plutus-shell-810`.

Note that HLS in particular won't work in the non-primary dev shell as it will still be built with the primary GHC version, but other tooling should work fine.

== Working conventions

Expand Down
29 changes: 23 additions & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ repository cardano-haskell-packages

-- See CONTRIBUTING for some Nix commands you will need to run if you
-- update either of these.

-- repeating hackage index-state to work around haskell.nix parsing limitation
index-state: 2023-03-24T00:00:00Z
index-state:
-- Bump this if you need newer packages from Hackage
, hackage.haskell.org 2023-03-24T00:00:00Z
-- Bump both the following dates if you need newer packages from Hackage
, hackage.haskell.org 2023-05-16T01:25:23Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2023-03-24T00:00:00Z
, cardano-haskell-packages 2023-05-16T08:53:30Z

packages: doc/read-the-docs-site
plutus-benchmark
Expand Down Expand Up @@ -53,3 +50,23 @@ package nothunks
-- See the note on nix/pkgs/default.nix:agdaPackages for why this is here.
-- (NOTE this will change to ieee754 in newer versions of nixpkgs).
extra-packages: ieee, filemanip

if impl(ghc >= 9.6)
allow-newer:
-- unmaintained? would be good to do something here
, int-cast:base
-- https://github.com/typeclasses/hex-text/issues/7
, hex-text:base
-- https://github.com/mokus0/th-extras/pull/20
, th-extras:template-haskell
, th-extras:th-abstraction

-- need https://github.com/tweag/HaskellR/commit/3cb01da0902ef705d2bd40874fe53333f4949b2f
-- for 9.6 support
-- need https://github.com/tweag/HaskellR/commit/e49242000a49b48511481c6b1bb6487d8965c524
-- to build with mtl-2.3
source-repository-package
type: git
location: https://github.com/tweag/HaskellR
tag: 411d15fe5027494123e326c838955eff1c8e7ec8
subdir: inline-r
4 changes: 2 additions & 2 deletions doc/read-the-docs-site/plutus-doc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ common lang
executable doc-doctests
import: lang

if ((impl(ghcjs) || os(windows)) || impl(ghc <9.0))
if (((impl(ghcjs) || os(windows)) || impl(ghc <9.2)) || impl(ghc >=9.3))
buildable: False

hs-source-dirs: tutorials howtos
Expand All @@ -70,7 +70,7 @@ executable doc-doctests
, base >=4.9 && <5
, bytestring
, containers
, flat <0.5
, flat ^>=0.6
, lens
, plutus-core ^>=1.6
, plutus-ledger-api ^>=1.6
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

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

8 changes: 7 additions & 1 deletion nix/cells/automation/ciJobs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ let

native-plutus-810-jobs = make-haskell-jobs library.plutus-project-810;
native-plutus-92-jobs = make-haskell-jobs library.plutus-project-92;
native-plutus-96-jobs = make-haskell-jobs library.plutus-project-96;

windows-plutus-92-jobs = make-haskell-jobs library.plutus-project-92.projectCross.mingwW64;

Expand All @@ -53,9 +54,14 @@ let
# Drop these once we switch to 9.2 by default
{ ghc810 = native-plutus-810-jobs; } //
{ ghc92 = native-plutus-92-jobs; } //
# 9.6 is busted on aarch64-darwin because of https://github.com/well-typed/cborg/issues/311
lib.optionalAttrs (system != "aarch64-darwin") { ghc96 = native-plutus-96-jobs; } //
# Only cross-compile to windows from linux
lib.optionalAttrs (system == "x86_64-linux") { mingwW64 = windows-plutus-92-jobs; } //
other-jobs;
# see above about 9.6 on aarch64-darwin
(if system == "aarch64-darwin"
then builtins.removeAttrs other-jobs [ "plutus-shell-96" ]
else other-jobs);

# Hydra doesn't like these attributes hanging around in "jobsets": it thinks they're jobs!
filtered-jobs = lib.filterAttrsRecursive (n: _: n != "recurseForDerivations") jobs;
Expand Down
2 changes: 2 additions & 0 deletions nix/cells/plutus/devshells/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ rec {

plutus-shell-92 = import ./plutus-shell-92.nix block;

plutus-shell-96 = import ./plutus-shell-96.nix block;

# TODO(std)
# profiled-plutus-shell = import ./profiled-plutus-shell.nix block;

Expand Down
3 changes: 3 additions & 0 deletions nix/cells/plutus/devshells/plutus-shell-96.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ inputs, cell }:

cell.library.make-plutus-shell { compiler-nix-name = "ghc961"; }
2 changes: 2 additions & 0 deletions nix/cells/plutus/library/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

plutus-project-92 = import ./plutus-project-92.nix block;

plutus-project-96 = import ./plutus-project-96.nix block;

# default
plutus-project = import ./plutus-project-92.nix block;

Expand Down
5 changes: 4 additions & 1 deletion nix/cells/plutus/library/make-plutus-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ let

inputMap = { "https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP; };
# No source-repository-packages right now
sha256map = { };
sha256map = {
"https://github.com/Topsii/foundation"."d3136f4bb8b69e273535352620e53f2196941b35" = "1l1idylvv25xp40zxxb5iim4xarpxfycwh85rmgabb0mbz4gw5rb"; # editorconfig-checker-disable-line
"https://github.com/tweag/HaskellR"."411d15fe5027494123e326c838955eff1c8e7ec8" = "0jax08z81xbfs3xz7zkk7x83cmr487iglifmxri205mf5bcj8ycj"; # editorconfig-checker-disable-line
};

# TODO: move this into the cabal.project using the new conditional support?
# Configuration settings needed for cabal configure to work when cross compiling
Expand Down
2 changes: 2 additions & 0 deletions nix/cells/plutus/library/plutus-project-96.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{ inputs, cell }:
cell.library.make-plutus-project { compiler-nix-name = "ghc961"; }
2 changes: 1 addition & 1 deletion nix/cells/plutus/packages/cabal-install.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
project = cell.library.haskell-nix.hackage-project {
name = "cabal-install";

version = "3.8.1.0";
version = "3.10.1.0";

compiler-nix-name = cell.library.ghc-compiler-nix-name;

Expand Down
36 changes: 18 additions & 18 deletions plutus-benchmark/plutus-benchmark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ library plutus-benchmark-common
library nofib-internal
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

-- Something weird causes this to sometimes report
Expand Down Expand Up @@ -100,7 +100,7 @@ library nofib-internal
executable nofib-exe
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

main-is: Main.hs
Expand All @@ -109,7 +109,7 @@ executable nofib-exe
, ansi-wl-pprint
, base >=4.9 && <5
, bytestring
, flat <0.5
, flat ^>=0.6
, lens
, nofib-internal
, optparse-applicative
Expand All @@ -121,7 +121,7 @@ executable nofib-exe
benchmark nofib
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand All @@ -137,7 +137,7 @@ benchmark nofib
benchmark nofib-hs
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand All @@ -153,7 +153,7 @@ benchmark nofib-hs
test-suite plutus-benchmark-nofib-tests
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand All @@ -174,7 +174,7 @@ test-suite plutus-benchmark-nofib-tests
library lists-internal
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

-- Something weird causes this to sometimes report
Expand Down Expand Up @@ -203,7 +203,7 @@ library lists-internal
executable list-sort-exe
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

main-is: Main.hs
Expand All @@ -218,7 +218,7 @@ executable list-sort-exe
benchmark lists
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand All @@ -233,7 +233,7 @@ benchmark lists
test-suite plutus-benchmark-lists-tests
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand Down Expand Up @@ -267,7 +267,7 @@ benchmark validation
, deepseq
, directory
, filepath
, flat <0.5
, flat ^>=0.6
, optparse-applicative
, plutus-benchmark-common
, plutus-core ^>=1.6
Expand All @@ -288,7 +288,7 @@ benchmark validation-decode
, deepseq
, directory
, filepath
, flat <0.5
, flat ^>=0.6
, optparse-applicative
, plutus-benchmark-common
, plutus-core ^>=1.6
Expand All @@ -309,7 +309,7 @@ benchmark validation-full
, deepseq
, directory
, filepath
, flat <0.5
, flat ^>=0.6
, optparse-applicative
, plutus-benchmark-common
, plutus-core ^>=1.6
Expand All @@ -320,7 +320,7 @@ benchmark validation-full
benchmark cek-calibration
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

-- Something weird causes this to sometimes report
Expand All @@ -344,7 +344,7 @@ benchmark cek-calibration
executable ed25519-throughput
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

default-language: Haskell2010
Expand All @@ -357,7 +357,7 @@ executable ed25519-throughput
, base >=4.9 && <5
, bytestring
, cardano-crypto-class
, flat <0.5
, flat ^>=0.6
, hedgehog
, plutus-core ^>=1.6
, plutus-tx ^>=1.6
Expand All @@ -368,7 +368,7 @@ executable ed25519-throughput
library script-contexts-internal
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

-- Something weird causes this to sometimes report
Expand All @@ -385,7 +385,7 @@ library script-contexts-internal
test-suite plutus-benchmark-script-contexts-tests
import: lang

if impl(ghc <9.0)
if (impl(ghc <9.2) || impl(ghc >=9.3))
buildable: False

type: exitcode-stdio-1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

-- | Budgeting benchmarks for cryptographic functions, including hashing.
module Benchmarks.Crypto (makeBenchmarks) where
Expand Down
4 changes: 3 additions & 1 deletion plutus-core/executables/debugger/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

{- | A Plutus Core debugger TUI application.
Expand Down Expand Up @@ -42,7 +43,8 @@ import Brick.Main qualified as B
import Brick.Util qualified as B
import Brick.Widgets.Edit qualified as BE
import Control.Concurrent
import Control.Monad.Except
import Control.Monad (void)
import Control.Monad.Except (runExcept)
import Control.Monad.ST (RealWorld)
import Data.Coerce
import Data.Maybe
Expand Down
3 changes: 2 additions & 1 deletion plutus-core/executables/uplc/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import UntypedPlutusCore.DeBruijn
import UntypedPlutusCore.Evaluation.Machine.Cek qualified as Cek

import Control.DeepSeq (rnf)
import Control.Monad.Except
import Control.Monad.Except (runExcept)
import Control.Monad.IO.Class (liftIO)
import Options.Applicative
import Prettyprinter
import System.Exit (exitFailure)
Expand Down
Loading

0 comments on commit ab4d2cc

Please sign in to comment.