[Haskell-cafe] New to Haskell, suggestions on code

Glynn Clements glynn at gclements.plus.com
Tue Jun 28 07:07:45 EDT 2005


Flavio Botelho wrote:

> At many places i have put a Char type instead of an abstract one because some 
> funcations were not working properly before and i wanted to be able to output 
> things and so be able to see what was the problem. 
> (Haskell doesnt seem a 'magic' function to output arbitrary structures? That 
> would be quite helpful for debugging)

The show method in the Show class generates a string representation of
an instance. The print function can be used to print the string
representation of any instance of Show to stdout.

All standard types except for functions are instances of Show, and
Haskell can automatically derive Show instances for user defined
types, provided that all of the constituent types are instances of
Show.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Haskell-Cafe mailing list