Remove type class instances from Term class.

All the type class instances have been moved out to the methods now. The
main victim has been toString, which now uses some rather ugly
heuristics to make pretty strings.