Tuple-like constructors

Pablo Barenbaum foones at gmail.com
Sat Feb 4 19:56:21 EST 2006


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".

As far as I can see, these are two issues:

1. There is not a way, for the programmer, to define
infinite constructors for infinite associated types (such as
(,) (,,) (,,,) ... / (a, b) (a, b, c) (a, b, c, d) ...)
these must be built-in.

2. There is not a way to define functions operating on all
of these types. Instead, different functions (like zip,
zip3) must be defined. Something similar happens with
liftM, liftM2, ... these are "limited".

It seems the language is lacking abstraction, or being
misused, when the standard prelude issues this code:

  zip              :: [a] -> [b] -> [(a,b)]
  zip               = zipWith  (\a b -> (a,b))

  zip3             :: [a] -> [b] -> [c] -> [(a,b,c)]
  zip3              = zipWith3 (\a b c -> (a,b,c))

Clearly, at least for a human being, it's redundant.
I don't know if there already are proposals to solve this.

Sorry if I sound aggresive, I'm just trying to help.
Excuse my English...

Best regards.

--
Pablo Barenbaum


More information about the Haskell-prime mailing list