navid/haze / 01a056cbc8ae312c5ec669249748a4961f2d4173629e1c9f271f909852ca7d91 / samples/baseline_2/orders.hz

orders.hz

← 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