[Haskell-cafe] Is it possible to represent such polymorphism?

Yves Parès limestrael at gmail.com
Mon Oct 3 00:12:03 CEST 2011

Yes, do you have a Python background?
Because I've often see misunderstanding about the utility of tuples with
persons who were used to Python, because Python tutorials usually induce *
BAD* practices in this respect (considering tuples and lists equivalent, for
Add to this the dynamic typing which allows you to have whatever type you
want in your tuples' cells, and when coming to Haskell, it's somewhat uneasy
to see that there is not a tuple type, but *an infinity*.

My advice (which is only my opinion) is that you should restrict you use of
tuples. For instance do not use them to make vectors (is it what you were
trying to do? Because it looked like you were trying to handle 2D and 3D
vectors), do something more type-explicit, by making a new datatype Vector,
or 2 new datatypes Vector2 and Vector3.
You shouldn't use tuples as a way to structure data (i.e. in replacement of
real types), only for convenience when a function has to return several

2011/10/2 Felipe Almeida Lessa <felipe.lessa at gmail.com>

> On Sun, Oct 2, 2011 at 4:26 PM, Edward Z. Yang <ezyang at mit.edu> wrote:
> > What are you actually trying to do?  This seems like a rather
> > unusual function.
> If you're new to the language, most likely you're doing something
> wrong if you need this kind of function.  =)
> --
> Felipe.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111003/63fbbb0f/attachment.htm>

More information about the Haskell-Cafe mailing list