extract pretty-printing into a separate module from term