(module embed_record_layout_carrier

  (data Pt
    (ctor Pt (con Int) (con Int)))

  (fn mk
    (type
      (fn-type
        (params (own (con Int)) (own (con Int)))
        (ret (own (con Pt)))))
    (params a b)
    (body (term-ctor Pt Pt a b)))

  (fn sum_pt
    (type
      (fn-type
        (params (borrow (con Pt)))
        (ret (own (con Int)))))
    (params p)
    (body
      (match p
        (case (pat-ctor Pt x y)
          (app + x y)))))

  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let s (app int_to_str (app sum_pt (app mk 3 4)))
        (do io/print_str s)))))
