[Haskell-cafe] Don't make 'show*' functions

Henning Thielemann lemming at henning-thielemann.de
Fri Dec 26 06:58:24 EST 2008


On Fri, 26 Dec 2008, Thomas DuBuisson wrote:

> Hello cafe,
> This is just a small thought, but its been bugging me.  We have these things called type classes
> for a reason (I like to think).  When making a new data type 'Data', it is not productive to
> avoid type classes such as 'Show' and export a 'showData' function.
> 
> Examples of what I'm talking about include showHtml, showTrie, showInstalledPackageInfo...
> 
> I know the default derivation (and thus generally accepted) instance of Show isn't pretty, but
> that just means to me that we need either more methods within the Show type class or start using
> the prettyclass package more.
> 
> If the problem is an API issue lets fix Pretty or Show.  But this show* stuff should disappear in
> the long run.

I disagree:
   http://www.haskell.org/haskellwiki/Slim_instance_declaration
   http://www.haskell.org/pipermail/libraries/2006-September/005791.html

There is not much to fix in Show (except the showList issue) since it is 
for showing Haskell expressions. One could however blame developers of 
calling pretty printing functions 'show*'. :-)


More information about the Haskell-Cafe mailing list