Formatting, comparing and hashing of recursive types