(module c4_rewrite (data Pair (doc "boxed pair of ints") (ctor MkPair (con Int) (con Int))) (fn both (doc "rewrite: destructure rest once via match") (type (fn-type (params (own (con Pair))) (ret (own (con Pair))))) (params rest) (body (match rest (case (pat-ctor MkPair a b) (term-ctor Pair MkPair a b))))))