(module hof
  (fn inc
    (doc "increment by one")
    (type (fn-type (params (own (con Int))) (ret (own (con Int)))))
    (params x)
    (body (app + x 1)))
  (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
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (app print (app apply inc 41)))))
