Tuple-like constructors

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Mon Feb 6 06:57:46 EST 2006

Pablo Barenbaum wrote:
> An awkwardness in Haskell I would like to see solved in
> Haskell', is the fact that the behavior of tuple-like
> constructors must be either built-in or "limited".

For software engineering reasons,
I'd argue against using tuples (as well as long parameter lists)
- positional notation is error-prone. (See Code smell, long argument
list, Refactoring, Introduce parameter Object)
Two-tuples are probably the right thing w.r.t. maps,
but that seems to be it.

Instead of longer tuples (or argument sequences),
we can get named notation by introducing data types.
Another advantage of custom-built types (above tuples)
is that it they improve type signatures:
they're shorter and more expressive.

Then a potential criticism is, if all types are custom-built,
then there can be no useful general libraries
(because they wouldn't know about the custom types).
With the potential answer that the custom types
can very well be used if they implement interfaces
that the library publishes. This again underlines
the importance of libraries relying on interfaces,
not concrete types.

Best regards,
-- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

More information about the Haskell-prime mailing list