Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-27 Thread Andreas Rossberg
<[EMAIL PROTECTED]> wrote: When you type "class Foo" in Java or C++, it does three things: 1. It declares a new type called "Foo". 2. It declares a _set_ of types (i.e. a "class"). 3. It declares that the type Foo (and all of its subtypes) is a member of the set of types Foo. I would add:

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread ajb
G'day all. Oh, one more thing. Quoting Aaron McDaid <[EMAIL PROTECTED]>: > Somebody more knowledgeable can describe the etymology of the terms, [...] You can think of a type as a set of values. For example, Bool is the set { False, True }. A "class", then, is a set of types. The distinction

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread ajb
G'day all. Quoting Aaron McDaid <[EMAIL PROTECTED]>: > 'class' in Haskell doesn't mean the same as 'class' in C++ or Java. I > found it easier at first to thing of them as: >A Haskell 'class' is more like a Java interface. >Haskell types are more like what you might think of as 'class'es.

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread Marc Weber
On Mon, Feb 26, 2007 at 01:22:57PM -0600, Thomas Nelson wrote: > I'm brand new to haskell and I'm having trouble using classes. The basic > idea is I want two classes, Sine and MetaSine, that are both instances of > ISine. This way I can use the act method and recurse through the metasines > an

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread Tillmann Rendel
Hello Thomas, Thomas Nelson schrieb: I'm brand new to haskell and I'm having trouble using classes. The basic idea is I want two classes, Sine and MetaSine, that are both instances of ISine. This way I can use the act method and recurse through the metasines and sines. That looks too much like

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread Aaron McDaid
On 2/26/07, Thomas Nelson <[EMAIL PROTECTED]> wrote: I'm brand new to haskell and I'm having trouble using classes. The basic idea is I want two classes, Sine and MetaSine, that are both instances of ISine. 'class' in Haskell doesn't mean the same as 'class' in C++ or Java. I found it easier a

Re: [Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread Albert Y. C. Lai
All record fields are in the same namespace, and furthermore this is also the same namespace of functions and class methods. In other words you cannot have two record types containing the same field name, and you cannot have a record field and a function using the same name, and you cannot have

[Haskell-cafe] Trouble with record syntax and classes

2007-02-26 Thread Thomas Nelson
I'm brand new to haskell and I'm having trouble using classes. The basic idea is I want two classes, Sine and MetaSine, that are both instances of ISine. This way I can use the act method and recurse through the metasines and sines. Here's my code: module Main where class ISine a where