changes TopicType to an algebraic one. Adds necessarry instances and
santizes to string