Skip to content

Commit

Permalink
Use maybe function instead of pattern matching
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Galazyn <[email protected]>
  • Loading branch information
palas and carbolymer authored Jan 31, 2025
1 parent 4d420e9 commit ff8b1b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cardano-cli/src/Cardano/CLI/Types/Output.hs
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,8 @@ renderScriptCosts (UTxO utxo) eUnitPrices scriptMapping =
where
getHashForScriptWitnessIndex
:: ScriptWitnessIndex -> Either PlutusScriptCostError (Maybe ScriptHash)
getHashForScriptWitnessIndex sWitInd = case lookup sWitInd scriptMapping of
Nothing -> Left (PlutusScriptCostErrPlutusScriptNotFound sWitInd)
Just script -> anyScriptWitnessToHash script
getHashForScriptWitnessIndex sWitInd =
maybe (PlutusScriptCostErrPlutusScriptNotFound sWitInd) anyScriptWitnessToHash $ lookup sWitInd scriptMapping

anyScriptWitnessToHash :: AnyScriptWitness era -> Either PlutusScriptCostError (Maybe ScriptHash)
anyScriptWitnessToHash = \case
Expand Down

0 comments on commit ff8b1b1

Please sign in to comment.