Data.Tree.Tree Show instance
Tue, 12 Aug 2003 13:42:07 +0200
On Tue, Aug 12, 2003 at 12:30:27PM +0200, Johannes Waldmann wrote:
> On Mon, 11 Aug 2003, Tomasz Zielonka wrote:
> > The Tree datatype in new Data.Tree module has a Show instance ...
> On the other hand, it is my opinion that for a clean program design,
> you should normally define your own `data' (or `newtype') types,
> rather than use exisiting ones by `type' synonyms.
> this may lead to somewhat larger program texts,
> but you'll find that they are more readable, and extendable.
> (Compare adding another component to a tuple, and to a record).
> this also gives you the opportunity
> to define class instances in any way you want.
I agree with you. I often define my own types using 'data' and
'newtype', even for things like IP adresses and numeric identifiers,
because I don't need and don't want many operations that integral types
provide but are meaningles in these applications. I also find datatypes
with named fields convenient. And I rarely define type synonyms,
probably only for some involved combinations of monad transformers.
However, I think that there are some types so generic, that they deserve
including in standard libraries. One example is a list - how often do
you define your own list type? But lists form a subset of trees, and
trees form a subset of graphs, so it would be nice to have them
delivered with GHC even if they would only be used in toy applications.
.signature: Too many levels of symbolic links