[Haskell-cafe] Default Tuple Orderings

Mark Spezzano mark.spezzano at chariot.net.au
Sun Mar 15 03:33:11 EDT 2009



Does anyone know how Haskell’s tuple ordering works? Presumably for some
tuple T1 (x1,x2,...xn) and another tuple T2 (y1,y2,...yn) Haskell would
compare T1 and T2 as follows:


T1 < T2 if:

x1 < y1 OR otherwise if x1 == y1 then if

x2 < y2 OR otherwise if x2 == y2 then if

x3 < y3 OR otherwise etc


xn < yn OR otherwise both tuple are equal


In other words my best guess is that the ordering of tuples is by comparing
the first tuple elements and then the seconds, thirds etc, until there’s an
element less than another.


Is this reasoning correct?


So minimum xs


would yield the “smallest” tuple (according to the above rules and if xs is
a list of tuples)?




Mark Spezzano


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.557 / Virus Database: 270.11.13/2001 - Release Date: 14/03/2009
6:54 AM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090315/cbcdc0fc/attachment.htm

More information about the Haskell-Cafe mailing list