-- 02: Function with dependencies
fn process
@ validate from address
@ shipping from rates
@ discount from pricing
order: order -> result order, text
let valid = validate addr: order.addr
match valid
false: err "Invalid shipping address"
true:
let ship = shipping
weight: order.weight,
dest: order.addr.country
let disc = discount
subtotal: order.subtotal,
code: order.code
let final = + (- order.subtotal disc) ship
ok order with total: final, cost: ship