proposal for anonymous-sum syntax

Andrew J Bromage ajb@spamcop.net
Sat, 22 Feb 2003 14:43:15 +1100


G'day all.

On Fri, Feb 21, 2003 at 04:28:27PM -0800, Richard Nathan Linger wrote:

> What do people think about this?
> Has anyone else ever wished they had such support for unnamed sums?

I sometimes wish that Haskell did _not_ have support for unnamed
product types.  To be honest, how hard is it to define a new type in
Haskell?  It usually takes only a couple more characters than the
equivalent type synonym.

Admittedly, this is a personal thing, however, I'm of the opinion
that types should be called what they are where possible.  With
the exception of built-in library functions (where "generic" types
are clearly better to use than program-specific types because
the library can't know about program-specific types by definition),
programmers should declare their own meaningful nontrivial custom types
(or at least wrap their nontrivial type synonyms in newtypes).  If
nothing else, your error messages will be the better for it.

Yes, this sounds dismissive.  I apologise.

> Does anyone have thoughts on why Haskell is biased towards products?

It's historical.  Tuple types go back long before Haskell.

I sometimes wonder if Haskell had records first if it would ever have
bothered with Miranda-esque tuple syntax.

Cheers,
Andrew Bromage