(module t2_length
  (data List (vars a)
    (ctor Nil)
    (ctor Cons a (con List)))
  (fn length
    (type (forall (vars a) (fn-type (params (con List a)) (ret (con Int)))))
    (params xs)
    (body (match xs
      (case (pat-ctor Nil) 0)
      (case (pat-ctor Cons _ t) (app + 1 (app length t))))))
  (fn main
    (type (fn-type (params) (ret (con Unit)) (effects IO)))
    (params)
    (body (seq (do io/print_int (app length (term-ctor List Nil))) (do io/print_int (app length (term-ctor List Cons 7 (term-ctor List Cons 8 (term-ctor List Cons 9 (term-ctor List Nil))))))))))
