Skip to content

Commit

Permalink
Merge pull request #108 from input-output-hk/mgalazyn/fix/ghc-9.6-build
Browse files Browse the repository at this point in the history
Fix build issues related to GHC-version dependend constraints
  • Loading branch information
disassembler authored Jul 25, 2023
2 parents be025cb + 1340dc1 commit f5e4259
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-07-11"
CABAL_CACHE_VERSION: "2023-07-25_108-1"

concurrency:
group: >
Expand Down
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ repository cardano-haskell-packages
-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-07-10T22:41:49Z
, cardano-haskell-packages 2023-07-17T06:35:34Z
, hackage.haskell.org 2023-07-27T22:41:49Z
, cardano-haskell-packages 2023-07-27T06:35:34Z

packages:
cardano-cli
Expand Down
6 changes: 4 additions & 2 deletions cardano-cli/app/cardano-cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#define UNIX
#endif

import Cardano.CLI.OS.Posix

import Cardano.CLI.Environment (getEnvCli)
import Cardano.CLI.Options (opts, pref)
import Cardano.CLI.Run (renderClientCommandError, runClientCommand)
Expand All @@ -17,6 +15,10 @@ import Control.Monad.Trans.Except.Exit (orDie)
import qualified GHC.IO.Encoding as GHC
import qualified Options.Applicative as Opt

#ifdef UNIX
import Cardano.CLI.OS.Posix
#endif

main :: IO ()
main = toplevelExceptionHandler $ do
Crypto.cryptoInit
Expand Down
6 changes: 4 additions & 2 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ library cardano-cli-test-lib
, transformers

test-suite cardano-cli-test
import: project-config, maybe-unix
import: project-config

hs-source-dirs: test/cardano-cli-test
main-is: cardano-cli-test.hs
Expand All @@ -209,14 +209,16 @@ test-suite cardano-cli-test
, cardano-crypto-class ^>= 2.1
, cardano-slotting ^>= 0.1
, containers
, filepath
, hedgehog
, hedgehog-extras ^>= 0.4.7.0
, parsec
, text
, time
, transformers

if !os(windows)
build-depends: filepath

other-modules: Test.Cli.CliIntermediateFormat
Test.Cli.FilePermissions
Test.Cli.ITN
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Run/Legacy/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ runAddressKeyGenToFile fmt kt vkf skf = case kt of

generateAndWriteByronKeyFiles
:: Key keyrole
#if __GLASGOW_HASKELL__ >= 940
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.4 and above complains if its
-- not present.
=> HasTypeProxy keyrole
Expand All @@ -93,7 +93,7 @@ generateAndWriteByronKeyFiles asType vkf skf = do

generateAndWriteKeyFiles
:: Key keyrole
#if __GLASGOW_HASKELL__ >= 940
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.4 and above complains if its
-- not present.
=> HasTypeProxy keyrole
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Run/Legacy/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ toSKeyJSON :: Key a => SigningKey a -> ByteString
toSKeyJSON = LBS.toStrict . textEnvelopeToJSON Nothing

toVkeyJSON ::
#if __GLASGOW_HASKELL__ >= 940
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.4 and above complains if its
-- not present.
(Key a, HasTypeProxy a) =>
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Types/Key.hs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ readVerificationKeyOrHashOrTextEnvFile asType verKeyOrHashOrFile =
VerificationKeyHash vkHash -> pure (Right vkHash)

generateKeyPair ::
#if __GLASGOW_HASKELL__ >= 940
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.4 and above complains if its
-- not present.
(Key keyrole, HasTypeProxy keyrole) =>
Expand Down
15 changes: 9 additions & 6 deletions cardano-cli/test/cardano-cli-test/Test/Cli/Pipes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@ module Test.Cli.Pipes
#define UNIX
#endif

import Prelude
import qualified Hedgehog as H
{- HLINT ignore "Use fewer imports" -}
import Hedgehog (Property, discover)

#ifdef UNIX
import Cardano.CLI.Run.Legacy.Read
import Cardano.CLI.OS.Posix

import Prelude

import qualified Data.ByteString.Char8 as BSC
import qualified Data.ByteString.Lazy as LBS
import System.FilePath ((</>))
import Test.Cardano.CLI.Util

import Hedgehog (Property, discover, forAll, (===))
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import Hedgehog ((===), forAll)
import qualified Hedgehog.Gen as G
import Hedgehog.Internal.Property (failWith)
import qualified Hedgehog.Range as R
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H

#ifdef UNIX

prop_readFromPipe :: Property
prop_readFromPipe = H.withTests 10 . H.property . H.moduleWorkspace "tmp" $ \ws -> do
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
# tools that work only with default compiler
stylish-haskell = "0.14.4.0";
hlint = "3.5";
#haskell-language-server = "2.0.0.0";
haskell-language-server = "2.0.0.0";
};
# and from nixpkgs or other inputs
shell.nativeBuildInputs = with nixpkgs; [
Expand Down Expand Up @@ -144,6 +144,7 @@
);
in
lib.recursiveUpdate flake rec {
project = cabalProject;
# add a required job, that's basically all hydraJobs.
hydraJobs =
nixpkgs.callPackages inputs.iohkNix.utils.ciJobsAggregates
Expand Down

0 comments on commit f5e4259

Please sign in to comment.