[Haskell-beginners] Are tuples really needed?
toad3k at gmail.com
Tue Aug 28 16:23:50 CEST 2012
Pattern matching makes tuples really useful. Sometimes you just want to
return a pair of values and you don't feel like making a one off
constructor for it.
Eg: random :: (RandomGen g, Random a) => g -> (a, g). Without tuples you'd
have to have a one off type data RandomGenWithRandom g a = RGWR g a, which
is overkill, when you just wanted two values.
On Mon, Aug 27, 2012 at 9:47 PM, Carlos J. G. Duarte <
carlos.j.g.duarte at gmail.com> wrote:
> Sorry if this question is too insane, but I was wondering if tuples are
> really needed in Haskell. I mean, could tuples be generally replaced by
> variables unroll (f x y z) and explicit data types, or are there some
> things only possible to do via tuples?
> Thx in advance (and sorry if this looks silly).
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners