Imagine that we are defining a custom Display
typeclass that acts like Show
but with a prettier formatting:
class Display a where
display :: a -> PrettyFormat
Would it be possible to make a simple function prettyPrint
that calls display
if the Display
type class is instantiated for the data type, and show
if it's not?