Skip to content

Commit

Permalink
Use more meaningful (phantom) types for files around governance comma…
Browse files Browse the repository at this point in the history
…nds.
  • Loading branch information
KtorZ committed Apr 20, 2023
1 parent 7bae590 commit 5849055
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions cardano-cli/src/Cardano/CLI/Shelley/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,12 @@ data GovernanceCmd
Text -- Prompt
[Text] -- Choices
(Maybe Word) -- Nonce
(File () Out)
(File GovernancePoll Out)
| GovernanceAnswerPoll
(File () In) -- Poll file
(SigningKeyFile In)
(File GovernancePoll In) -- Poll file
(Maybe Word) -- Answer index
| GovernanceVerifyPoll
(File () In) -- Poll file
(File GovernancePoll In) -- Poll file
(File (Tx ()) In) -- Tx file
deriving Show

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ pPollAnswerIndex =
<> Opt.help "The index of the chosen answer in the poll. Optional. Asked interactively if omitted."
)

pPollFile :: Parser (File () In)
pPollFile :: Parser (File GovernancePoll In)
pPollFile =
Opt.strOption
( Opt.long "poll-file"
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ runGovernanceCreatePoll
:: Text
-> [Text]
-> Maybe Word
-> File () Out
-> File GovernancePoll Out
-> ExceptT ShelleyGovernanceCmdError IO ()
runGovernanceCreatePoll govPollQuestion govPollAnswers govPollNonce out = do
let poll = GovernancePoll{ govPollQuestion, govPollAnswers, govPollNonce }
Expand Down Expand Up @@ -255,7 +255,7 @@ runGovernanceCreatePoll govPollQuestion govPollAnswers govPollNonce out = do
]

runGovernanceAnswerPoll
:: File () In
:: File GovernancePoll In
-> Maybe Word
-- ^ Answer index
-> ExceptT ShelleyGovernanceCmdError IO ()
Expand Down Expand Up @@ -321,7 +321,7 @@ runGovernanceAnswerPoll pollFile maybeChoice = do
left ShelleyGovernanceCmdPollInvalidChoice

runGovernanceVerifyPoll
:: File () In
:: File GovernancePoll In
-> File (Tx ()) In
-> ExceptT ShelleyGovernanceCmdError IO ()
runGovernanceVerifyPoll pollFile txFile = do
Expand Down

0 comments on commit 5849055

Please sign in to comment.