clean up; apply hlint suggestions; format

This commit is contained in:
fanghr 2022-04-23 18:46:38 +08:00
parent 430f5ba427
commit 03c8009e27
No known key found for this signature in database
GPG key ID: 35CD9A71CD5D5870
2 changed files with 12 additions and 12 deletions

View file

@ -371,8 +371,6 @@ governorValidator gov =
case redeemer of
PCreateProposal _ -> P.do
let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId
expectedNewDatum :: Term _ PGovernorDatum
expectedNewDatum =
pcon $
PGovernorDatum $
@ -380,7 +378,7 @@ governorValidator gov =
#$ pdcons @"nextProposalId" # pdata expectedNextProposalId # pdnil
passert "Unexpected governor state datum" $
newDatumData #== (pforgetData $ pdata $ expectedNewDatum)
newDatumData #== pforgetData (pdata expectedNewDatum)
passert "Exactly one proposal token must be minted" $
hasOnlyOneTokenOfCurrencySymbol # pproposalSymbol # txInfo.mint
@ -520,8 +518,10 @@ governorValidator gov =
(pcon $ PJust pair)
)
votesList = pto $ pto $ pfromData inputProposalDatum.votes
winner' =
pfoldr # highestVoteFolder # (pcon $ PNothing) #$ pto $ pto $ pfromData inputProposalDatum.votes
pfoldr # highestVoteFolder # (pcon PNothing) # votesList
winner <- plet $ mustBePJust # "Empty votes" # winner'
@ -542,13 +542,13 @@ governorValidator gov =
outputsWithGAT <-
plet $
pfilter
# ( phoistAcyclic $
plam
( \((pfield @"value" #) -> value) ->
0 #< psymbolValueOf # pgatSym # value
)
# phoistAcyclic
( plam
( \((pfield @"value" #) -> value) ->
0 #< psymbolValueOf # pgatSym # value
)
)
#$ pfromData txInfo.outputs
# pfromData txInfo.outputs
passert "Output GATs is more than minted GATs" $
plength # outputsWithGAT #== gatCount

View file

@ -555,7 +555,7 @@ mustFindDatum' = phoistAcyclic $
PJust dt <- pmatch $ pfindDatum # dh # info
pfromData $ punsafeCoerce dt
{- | Extract the value stored in a PMaybe container.
{- | Extract the value stored in a PMaybe container.
If there's no value, throw an error with the given message.
-}
mustBePJust :: forall a s. Term s (PString :--> PMaybe a :--> a)
@ -564,7 +564,7 @@ mustBePJust = phoistAcyclic $
PJust v -> v
_ -> ptraceError emsg
{- | Extract the value stored in a PMaybeData container.
{- | Extract the value stored in a PMaybeData container.
If there's no value, throw an error with the given message.
-}
mustBePDJust :: forall a s. (PIsData a) => Term s (PString :--> PMaybeData a :--> a)