update type and term show to take ostream as a constructor argument