navid/haze / 221433b37405f424c4ca0e8131b8d4d4c92a29bd547e3562beac70a7b8f81878 / samples/baseline_2/orders.xyz

orders.xyz

← samples/baseline_2 · 294 bytes · raw · download

// Module `orders`: a small domain model.

const BIG_ORDER i32 = 100            // private: not visible outside this file

pub type Order {
    id    i32
    qty   i32
    price i32
}

pub pure fn total(o Order) i32 => o.qty * o.price

pub pure fn is_big(o Order) bool => total(o) >= BIG_ORDER