(module fp_map (data IntList (doc "boxed list") (ctor Nil) (ctor Cons (con Int) (con IntList))) (fn map_int (doc "recursive HOF: f applied AND passed to the recursive call") (type (fn-type (params (borrow (fn-type (params (own (con Int))) (ret (own (con Int))))) (own (con IntList))) (ret (own (con IntList))))) (params f xs) (body (match xs (case (pat-ctor Nil) (term-ctor IntList Nil)) (case (pat-ctor Cons h t) (term-ctor IntList Cons (app f h) (app map_int f t)))))))