Skip to content

Commit

Permalink
Make it build with ghc-9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Jul 17, 2023
1 parent e5030d9 commit 7c32575
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 5 deletions.
24 changes: 23 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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-05T20:00:33Z
, hackage.haskell.org 2023-07-10T22:41:49Z
, cardano-haskell-packages 2023-07-13T14:00:00Z

packages:
Expand All @@ -37,6 +37,28 @@ test-show-details: direct
-- Always write GHC env files, because they are needed for ghci.
write-ghc-environment-files: always

-- https://github.com/obsidiansystems/dependent-sum-template/issues/5
if impl(ghc >= 9.2)
constraints :
dependent-sum-template < 0.1.2

if impl(ghc >= 9.6)
allow-newer:
-- Only really needed because `cardano-ledger-byron-test` has not yet been released to CHaP
-- and its not possible to specify `cardano-ledger-byron-test:base` because the dependencies
-- of `cardano-ledger-byron-test` also do not permit the version of `base` that `ghc-9.6`
-- provides.
, *:base

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-api
tag: 9e018cc133bafaf9be899087d27199e6bdb5b3de
subdir:
cardano-api
cardano-api-gen


-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ common project-config
default-language: Haskell2010

default-extensions: OverloadedStrings
build-depends: base >= 4.14 && < 4.17
build-depends: base >= 4.14 && < 4.19

ghc-options: -Wall
-Wcompat
Expand Down
11 changes: 10 additions & 1 deletion cardano-cli/src/Cardano/CLI/Shelley/Key.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
Expand Down Expand Up @@ -205,7 +206,15 @@ readVerificationKeyOrHashOrTextEnvFile asType verKeyOrHashOrFile =
pure (verificationKeyHash <$> eitherVk)
VerificationKeyHash vkHash -> pure (Right vkHash)

generateKeyPair :: Key keyrole => AsType keyrole -> IO (VerificationKey keyrole, SigningKey keyrole)
generateKeyPair ::
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.2 and above complains if its
-- not present.
(Key keyrole, HasTypeProxy keyrole) =>
#else
Key keyrole =>
#endif
AsType keyrole -> IO (VerificationKey keyrole, SigningKey keyrole)
generateKeyPair asType = do
skey <- generateSigningKey asType
return (getVerificationKey skey, skey)
11 changes: 11 additions & 0 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Address.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
Expand Down Expand Up @@ -78,6 +79,11 @@ runAddressKeyGenToFile fmt kt vkf skf = case kt of

generateAndWriteByronKeyFiles
:: Key keyrole
#if __GLASGOW_HASKELL__ >= 902
-- GHC 8.10 considers the HasTypeProxy constraint redundant but ghc-9.2 and above complains if its
-- not present.
=> HasTypeProxy keyrole
#endif
=> AsType keyrole
-> VerificationKeyFile Out
-> SigningKeyFile Out
Expand All @@ -87,6 +93,11 @@ generateAndWriteByronKeyFiles asType vkf skf = do

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

toVkeyJSON :: Key a => SigningKey a -> ByteString
toVkeyJSON :: (Key a, HasTypeProxy a) => SigningKey a -> ByteString
toVkeyJSON = LBS.toStrict . textEnvelopeToJSON Nothing . getVerificationKey

toVkeyJSON' :: Key a => VerificationKey a -> ByteString
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Shelley/Run/Key.hs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ data SomeSigningKey
| AKesSigningKey (SigningKey KesKey)

withSomeSigningKey :: SomeSigningKey
-> (forall keyrole. Key keyrole => SigningKey keyrole -> a)
-> (forall keyrole. (Key keyrole, HasTypeProxy keyrole) => SigningKey keyrole -> a)
-> a
withSomeSigningKey ssk f =
case ssk of
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
Expand Down

0 comments on commit 7c32575

Please sign in to comment.