Skip to content

Commit

Permalink
Move away from Opt.auto in EraBased/Options/Common.hs
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Aug 21, 2024
1 parent fdeb30d commit 6483900
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

Check warning

Code scanning / HLint

Unused LANGUAGE pragma Warning

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:7:1-30: Warning: Unused LANGUAGE pragma
  
Found:
  {-# LANGUAGE TupleSections #-}
  
Perhaps you should remove it.
{-# LANGUAGE TypeApplications #-}

{- HLINT ignore "Move brackets to avoid $" -}
Expand Down Expand Up @@ -1238,7 +1239,7 @@ pScriptWitnessFiles sbe witctx autoBalanceExecUnits scriptFlagPrefix scriptFlagP
pExecutionUnits :: String -> Parser ExecutionUnits
pExecutionUnits scriptFlagPrefix =
fmap (uncurry ExecutionUnits) $
Opt.option Opt.auto $
Opt.option ((,) <$> integralReader <*> integralReader) $
mconcat
[ Opt.long (scriptFlagPrefix ++ "-execution-units")
, Opt.metavar "(INT, INT)"
Expand Down Expand Up @@ -2327,7 +2328,7 @@ pTotalCollateral =

pWitnessOverride :: Parser Word
pWitnessOverride =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "witness-override"
, Opt.metavar "WORD"
Expand All @@ -2336,7 +2337,7 @@ pWitnessOverride =

pNumberOfShelleyKeyWitnesses :: Parser Int
pNumberOfShelleyKeyWitnesses =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "shelley-key-witnesses"
, Opt.metavar "INT"
Expand All @@ -2345,7 +2346,7 @@ pNumberOfShelleyKeyWitnesses =

pNumberOfByronKeyWitnesses :: Parser Int
pNumberOfByronKeyWitnesses =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "byron-key-witnesses"
, Opt.metavar "Int"
Expand Down Expand Up @@ -2609,7 +2610,7 @@ pInvalidHereafter eon =
pTxFee :: Parser Lovelace
pTxFee =
fmap (L.Coin . (fromIntegral :: Natural -> Integer)) $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "fee"
, Opt.metavar "LOVELACE"
Expand Down Expand Up @@ -2695,7 +2696,7 @@ pInputTxOrTxBodyFile =
pTxInCountDeprecated :: Parser TxInCount
pTxInCountDeprecated =
fmap TxInCount $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "tx-in-count"
, Opt.metavar "NATURAL"
Expand All @@ -2705,7 +2706,7 @@ pTxInCountDeprecated =
pTxOutCountDeprecated :: Parser TxOutCount
pTxOutCountDeprecated =
fmap TxOutCount $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "tx-out-count"
, Opt.metavar "NATURAL"
Expand All @@ -2715,7 +2716,7 @@ pTxOutCountDeprecated =
pTxShelleyWitnessCount :: Parser TxShelleyWitnessCount
pTxShelleyWitnessCount =
fmap TxShelleyWitnessCount $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "witness-count"
, Opt.metavar "NATURAL"
Expand All @@ -2725,7 +2726,7 @@ pTxShelleyWitnessCount =
pTxByronWitnessCount :: Parser TxByronWitnessCount
pTxByronWitnessCount =
fmap TxByronWitnessCount $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "byron-witness-count"
, Opt.metavar "NATURAL"
Expand Down Expand Up @@ -3167,7 +3168,7 @@ pMinPoolCost =

pMaxBodySize :: Parser Word32
pMaxBodySize =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "max-block-body-size"
, Opt.metavar "WORD32"
Expand All @@ -3176,7 +3177,7 @@ pMaxBodySize =

pMaxTransactionSize :: Parser Word32
pMaxTransactionSize =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "max-tx-size"
, Opt.metavar "WORD32"
Expand Down Expand Up @@ -3253,7 +3254,7 @@ pEpochBoundRetirement =

pNumberOfPools :: Parser Natural
pNumberOfPools =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "number-of-pools"
, Opt.metavar "NATURAL"
Expand Down Expand Up @@ -3363,7 +3364,7 @@ pMaxTxExecutionUnits :: Parser ExecutionUnits
pMaxTxExecutionUnits =
uncurry ExecutionUnits
<$> Opt.option
Opt.auto
((,) <$> integralReader <*> integralReader)
( mconcat
[ Opt.long "max-tx-execution-units"
, Opt.metavar "(INT, INT)"
Expand All @@ -3379,7 +3380,7 @@ pMaxBlockExecutionUnits :: Parser ExecutionUnits
pMaxBlockExecutionUnits =
uncurry ExecutionUnits
<$> Opt.option
Opt.auto
((,) <$> integralReader <*> integralReader)
( mconcat
[ Opt.long "max-block-execution-units"
, Opt.metavar "(INT, INT)"
Expand All @@ -3393,7 +3394,7 @@ pMaxBlockExecutionUnits =

pMaxValueSize :: Parser Natural
pMaxValueSize =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "max-value-size"
, Opt.metavar "INT"
Expand All @@ -3405,7 +3406,7 @@ pMaxValueSize =

pCollateralPercent :: Parser Natural
pCollateralPercent =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "collateral-percent"
, Opt.metavar "INT"
Expand All @@ -3419,7 +3420,7 @@ pCollateralPercent =

pMaxCollateralInputs :: Parser Natural
pMaxCollateralInputs =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "max-collateral-inputs"
, Opt.metavar "INT"
Expand All @@ -3435,14 +3436,14 @@ pProtocolVersion =
(,) <$> pProtocolMajorVersion <*> pProtocolMinorVersion
where
pProtocolMajorVersion =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "protocol-major-version"
, Opt.metavar "NATURAL"
, Opt.help "Major protocol version. An increase indicates a hard fork."
]
pProtocolMinorVersion =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "protocol-minor-version"
, Opt.metavar "NATURAL"
Expand Down Expand Up @@ -3592,7 +3593,7 @@ pDRepVotingThresholds =

pMinCommitteeSize :: Parser Natural
pMinCommitteeSize =
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "min-committee-size"
, Opt.metavar "INT"
Expand Down Expand Up @@ -3962,7 +3963,7 @@ pNetworkIdForTestnetData envCli =
pReferenceScriptSize :: Parser ReferenceScriptSize
pReferenceScriptSize =
fmap ReferenceScriptSize $
Opt.option Opt.auto $
Opt.option integralReader $
mconcat
[ Opt.long "reference-script-size"
, Opt.metavar "NATURAL"
Expand Down

0 comments on commit 6483900

Please sign in to comment.