(module closure
  (fn apply
    (doc "apply a fn-of-Int to an Int")
    (type (fn-type (params (own (fn-type (params (own (con Int))) (ret (own (con Int))))) (own (con Int))) (ret (own (con Int)))))
    (params f x)
    (body (app f x)))
  (fn main
    (doc "captures `n` from the enclosing let, returns 42")
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (let n 3 (app print (app apply (lam (params (typed x (con Int))) (ret (con Int)) (body (app + x n))) 39))))))
