Make Show instances produce valid Haskell and fix their uses
Clarification and motivation
Quoting once again from #742 (closed):
There's an unwritten expectation that the output of
show
should be a string you can copy-paste back into the editor.
While working on that issue however some issues with other Show
instances have been noted.
We should fix them, in particular making sure that:
- whenever possible (aka where #752 (closed) doesn't apply),
Show
instance should match the expectation above -
Show
instances shouldn't be expected to perform, nor be used for, pretty-printing (that's forBuildable
), printing of valid Michelson (that's forRenderDoc
) - when not derived (for "enhancement" of the output, e.g. to show type annotations), they should support proper paren-wrapping (see
showsPrec
)
Acceptance criteria
-
Show
instances produce valid Haskell code wherever possible, including parenthesis depending on context - uses of
Show
instances that rely on them producing pretty-printed text or valid Michelson are replaced to useBuildable
andRenderDoc
, respectively