[Haskell-beginners] flatten comma operator

Brent Yorgey byorgey at seas.upenn.edu
Wed Jun 6 12:58:57 CEST 2012

On Wed, Jun 06, 2012 at 09:46:58AM +0200, Kees Bleijenberg wrote:
> This is indeed the code I was talking about.
> I did not understand how I could create (1,2,3) with the comma operator
> (,)((,) 1 2) 3 = ((1,2),3) and not (1,2,3). That's why I thought I needed a
> kind of join operation to 'flatten' this.

It's not possible to create a triple using only the (,) operator --
there's no way to do the join/flatten operation you have in mind,
because there's no valid type it could be assigned (unless you make it
specific to three-tuples, but I'm guessing you have something more
general in mind).

> Indeed (,,) 1 2 3 is (1,2,3). But I do not understand what is happening. Is
> (,,) predefined? Probably not.

Yes, it is!


More information about the Beginners mailing list