
On Feb 10, 2008 3:40 PM, Mattes Simeon
Thanks for your help. It was very useful.
Though in comparison with C or C++ I can't figure out so clear the syntax. Maybe it has to do with the syntactic Sugar of each Language. I 'll give you a similar example I saw in a book for Haskel
The following program just returns the value of the position of a datatype Tuple which can hold one or two elements.
data Tuple a b = One a | Two a b tuple1 (One a)= Just a tuple1 (Two a b) = Just a
tuple2 (One a) = Nothing tuple2 (Two a b) = Just b
The corresponding Version in C++, which seems to be more appropriate, would be
I think this is the most native way to do it in C++:
template