Show value

repl example
> data Piece = Bishop | Rook

> Bishop
"No instance for (Show Piece) arising from a use of ‘print’"

Haskell is complaining that it doesn't have know how to serialize the value Bishop into a String (because Piece isn't an instance of the Show typeclass).

Fix as follows:

repl example
> data Piece = Bishop | Rook deriving Show
> Bishop

This instructs the compiler to create the obvious Show instance for Piece.


Haskell cannot derive a Show instance for all types - data types containing functions in particular are a problem because there is no obvious way to show them.