Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Are tuples really needed? (Peter Hall)


----------------------------------------------------------------------

Message: 1
Date: Tue, 28 Aug 2012 05:45:20 +0100
From: Peter Hall <[email protected]>
Subject: Re: [Haskell-beginners] Are tuples really needed?
To: "Carlos J. G. Duarte" <[email protected]>
Cc: [email protected]
Message-ID:
        <CAA6hAk4=YzoE+1D42jOh2iYmxpp6=ZN7OkB=d-dvuhs+q8r...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

They are just syntactic sugar. You can just as easily create your own
tuple types:

data Tuple2 a b = Tuple2 a b
data Tuple3 a b c = Tuple3 a b c
data Tuple4 a b c d = Tuple4 a b c d
..etc

...except it's pretty ugly and none of the built-in Prelude functions
that use tuples will work with them (curry, uncurry, fst, snd, lookup,
zip,..).

Peter


On 28 August 2012 02:47, Carlos J. G. Duarte
<[email protected]> 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
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 50, Issue 32
*****************************************

Reply via email to