Skip to content

Commit

Permalink
Refactor: Replace ListMap.toList, ListMap.fromList with IsList(toList…
Browse files Browse the repository at this point in the history
…,fromList)
  • Loading branch information
carbolymer committed Aug 13, 2024
1 parent 58c2d30 commit f44a671
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ test-suite cardano-cli-golden
cardano-cli,
cardano-cli:cardano-cli-test-lib,
cardano-crypto-wrapper,
cardano-data >=1.1,
cardano-ledger-byron,
cardano-ledger-shelley >=1.10.0.0,
cardano-strict-containers ^>=0.1,
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ updateOutputTemplate
, sgMaxLovelaceSupply = fromIntegral $ nonDelegCoin + delegCoin
, sgGenDelegs = shelleyDelKeys
, sgInitialFunds =
ListMap.fromList
fromList
[ (toShelleyAddr addr, v)
| (addr, v) <-
distribute (nonDelegCoin - subtractForTreasury) nUtxoAddrsNonDeleg utxoAddrsNonDeleg
Expand Down Expand Up @@ -1080,7 +1080,7 @@ updateTemplate
, sgMaxLovelaceSupply = fromIntegral $ nonDelegCoin + delegCoin
, sgGenDelegs = shelleyDelKeys
, sgInitialFunds =
ListMap.fromList
fromList
[ (toShelleyAddr addr, v)
| (addr, v) <-
distribute (nonDelegCoin - subtractForTreasury) utxoAddrsNonDeleg
Expand All @@ -1090,7 +1090,7 @@ updateTemplate
, sgStaking =
ShelleyGenesisStaking
{ sgsPools =
ListMap.fromList
fromList
[ (L.ppId poolParams, poolParams)
| poolParams <- Map.elems poolSpecs
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import qualified Data.Aeson as Aeson
import Data.Bifunctor (Bifunctor (..))
import qualified Data.ByteString.Lazy.Char8 as LBS
import Data.ListMap (ListMap (..))
import qualified Data.ListMap as ListMap
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Maybe (fromMaybe)
Expand Down Expand Up @@ -351,7 +350,7 @@ runGenesisCreateTestNetDataCmd
:: [(VerificationKey StakeKey, VerificationKey DRepKey)]
-> ListMap (L.Credential L.Staking L.StandardCrypto) (L.Delegatee L.StandardCrypto)
delegs =
ListMap.fromList
fromList
. map
( bimap
verificationKeytoStakeCredential
Expand All @@ -363,7 +362,7 @@ runGenesisCreateTestNetDataCmd
-> [VerificationKey DRepKey]
-> ListMap (L.Credential L.DRepRole L.StandardCrypto) (L.DRepState L.StandardCrypto)
initialDReps minDeposit =
ListMap.fromList
fromList
. map
( \c ->
( verificationKeyToDRepCredential c
Expand Down Expand Up @@ -706,7 +705,7 @@ updateOutputTemplate
, sgMaxLovelaceSupply = totalSupply
, sgGenDelegs = shelleyDelKeys
, sgInitialFunds =
ListMap.fromList
fromList
[ (toShelleyAddr addr, v)
| (addr, v) <-
distribute nonDelegCoin nUtxoAddrsNonDeleg utxoAddrsNonDeleg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import qualified Cardano.Ledger.Shelley.API as L
import Control.Monad
import Control.Monad.IO.Class
import Data.List (intercalate, sort)
import qualified Data.ListMap as ListMap
import qualified Data.Sequence.Strict as Seq
import Data.Word (Word32)
import GHC.Exts (IsList (..))
import System.Directory
import System.Directory.Extra (listDirectories)
import System.FilePath
Expand Down Expand Up @@ -179,7 +179,7 @@ hprop_golden_create_testnet_data_deleg_non_deleg =
-- Because we don't test this elsewhere in this file:
(L.sgMaxLovelaceSupply genesis) H.=== (fromIntegral totalSupply)

let initialFunds = ListMap.toList $ L.sgInitialFunds genesis
let initialFunds = toList $ L.sgInitialFunds genesis
-- This checks that there is actually only one funded address
(length initialFunds) H.=== 1

Expand Down

0 comments on commit f44a671

Please sign in to comment.