navid/haze / ea08ceb46539df9cf3ac396bc0bd66fc4f6b9adc630e1596e79b8e4d3101673a / 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