Skip to content

Commit

Permalink
PLT-4169 Added note on use of foldr in semantics.
Browse files Browse the repository at this point in the history
This addresses the audit comment:

> Helper function convertReduceWarnings, lines 617 (Semantics.hs),
> 537 (Semantics.thy) The Haskell function is implemented using
> foldr, while the Isabelle function uses explicit recursion,
> making a oneto-one comparison less obvious. If there is a
> reason for this discrepancy, such as foldr yielding some
> optimizations, this should be outlined in a comment.
  • Loading branch information
bwbush committed Mar 15, 2023
1 parent d0a3834 commit d147761
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion marlowe/src/Language/Marlowe/Core/V1/Semantics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ applyInput _ _ _ _ = ApplyNoMatchError

-- | Propagate 'ReduceWarning' to 'TransactionWarning'.
convertReduceWarnings :: [ReduceWarning] -> [TransactionWarning]
convertReduceWarnings = foldr (\warn acc -> case warn of
convertReduceWarnings = foldr (\warn acc -> case warn of -- Note that `foldr` is used here for efficiency, differing from Isabelle.
ReduceNoWarning -> acc
ReduceNonPositivePay accId payee tok amount ->
TransactionNonPositivePay accId payee tok amount : acc
Expand Down

0 comments on commit d147761

Please sign in to comment.