(module match_arm_consume_split_no_leak_pin
  (data Box (ctor B (con Int)))
  (data Flag (ctor On) (ctor Off))
  (fn sink
    (type (fn-type (params (own (con Box))) (ret (own (con Unit))) (effects IO)))
    (params b)
    (body (match b (case (pat-ctor B n) (do io/print_str "x")))))
  (fn run
    (type (fn-type (params (own (con Box)) (own (con Flag))) (ret (own (con Unit))) (effects IO)))
    (params b f)
    (body
      (match f
        (case (pat-ctor Off) (do io/print_str ""))
        (case (pat-ctor On) (app sink b)))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body
      (let b (term-ctor Box B 7)
        (seq
          (app run b (term-ctor Flag Off))
          (do io/print_str "done\n"))))))
