; Classify a temperature into a 0..3 band via a let-bound code.
; classify 22 = 2 ("warm"). Expected stdout: 2

(module mut-local_2_classify_temp

  (fn classify
    (doc "Return category code 0..3 for temperature t in degrees C.")
    (type (fn-type (params (own (con Int))) (ret (own (con Int)))))
    (params t)
    (body (let code 0 (let code (if (app lt t 0) 0 (if (app lt t 15) 1 (if (app lt t 28) 2 3))) code))))

  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (app print (app classify 22)))))
