Enforce newline after assignment / clause.

This leads to more consistent formatting across entire Aiken programs.
  Before that commit, only long expressions would be formatted on a
  newline, causing non-consistent formatting and additional reading
  barrier when looking at source code.

  Programs also now take more vertical space, which is better for more
  friendly diffing in version control systems (especially git).
This commit is contained in:
KtorZ
2023-03-16 19:42:57 +01:00
parent bf9297efcf
commit 20f5baffa7
60 changed files with 998 additions and 548 deletions

View File

@@ -3,19 +3,20 @@ use aiken/list
use aiken/transaction.{Output, OutputReference, ScriptContext}
use aiken/transaction/value.{PolicyId}
const my_policy_id: PolicyId = #"0000000000"
const my_policy_id: PolicyId =
#"0000000000"
pub fn has_policy_id(self: Output, policy_id: PolicyId) -> Bool {
self.value
|> value.tokens(policy_id)
|> dict.is_empty
|> not
|> value.tokens(policy_id)
|> dict.is_empty
|> not
}
validator spend {
fn(_datum: Data, _redeemer: Data, ctx: ScriptContext) -> Bool {
ctx.transaction.outputs
|> list.any(has_policy_id(_, my_policy_id))
|> list.any(has_policy_id(_, my_policy_id))
}
}
@@ -27,8 +28,10 @@ validator mint(output_reference: OutputReference) {
fn(input) { input.output_reference == output_reference },
)
is {
Some(_) -> True
None -> False
Some(_) ->
True
None ->
False
}
}
}