[Haskell-cafe] Re: Datatypes - Haskell

2008-02-12 Thread Jon Fairbairn
Richard A. O'Keefe [EMAIL PROTECTED] writes: On the subject of data types, I've recently seen Haskell code using data Foo ... = Foo { ... } where I would have used newtype instead of data. When is it a good idea to avoid newtype? When the code was written before newtype was introduced

Re: [Haskell-cafe] Re: Datatypes - Haskell

2008-02-11 Thread Don Stewart
ok: On the subject of data types, I've recently seen Haskell code using data Foo ... = Foo { ... } where I would have used newtype instead of data. When is it a good idea to avoid newtype? It depends what's in the ... If its just something with the same representation as an existing

[Haskell-cafe] Re: Datatypes - Haskell

2008-02-10 Thread 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

Re: [Haskell-cafe] Re: Datatypes - Haskell

2008-02-10 Thread Victor Nazarov
On Feb 10, 2008 3:40 PM, Mattes Simeon [EMAIL PROTECTED] wrote: 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

Re: [Haskell-cafe] Re: Datatypes - Haskell

2008-02-10 Thread ajb
G'day all. On Feb 10, 2008 3:40 PM, Mattes Simeon [EMAIL PROTECTED] wrote: Though in comparison with C or C++ I can't figure out so clear the syntax. Quoting Victor Nazarov [EMAIL PROTECTED]: I think this is the most native way to do it in C++: Herb Sutter and Andrei Alexandrescu will

Re: [Haskell-cafe] Re: Datatypes - Haskell

2008-02-10 Thread Jason Dusek
Mattes Simeon [EMAIL PROTECTED] wrote: Though in comparison with C or C++ I can't figure out so clear the syntax...I seems realy strange, and I'm confused. Surely a solution to this would be to use the standard types of Haskel for tuples and check out each time if I have just a number or a