
On 14 January 2014 14:58, Cary Cherng
What exactly is the purpose in having both records and tuples? They seem to behave rather similarly although records do have the extra naming of the fields that tuples don't.
Tuples: let you quickly group values together for one-off cases. Custom data types: named grouping of values so you can give them a specific type; optionally not exposing constructor so that you can hide internals. Record syntax is a a way of naming specific fields within these data types. Note that what you actually seem to be asking is "why have any data type whose constructor can take more than one value", as this is what a tuple is a specific instance of: data Pair a b = Pair a b data Triple a b c = Triple a b c etc. You can consider tuples to be pre-defined types with convenient syntax. But if you want to properly type your code you should define your own types as appropriate.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com