Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Miguel Mitrofanov
class A a type T = (forall x.Num x=x) instance A T type declares a synonym, like #define in C - but working only on types. So, essentially, you wrote instance A (forall x.Num x = x) which is not very Haskelly. I am simply trying to state that all members of typeclass Num are of typeclass

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Luke Palmer
On Jan 10, 2008 1:03 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: Should be straight forwardsimplest example is... class A a data D = D1 instance A D fine.D is declared to be a member of type class A what about. class A a type T = (forall x.Num x=x) instance A T

RE: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Nicholls, Mark
on? -Original Message- From: Luke Palmer [mailto:[EMAIL PROTECTED] Sent: 10 January 2008 13:14 To: Nicholls, Mark Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] confusion about 'instance' On Jan 10, 2008 1:03 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: Should be straight forward

RE: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Nicholls, Mark
class A a type T = (forall x.Num x=x) instance A T type declares a synonym, like #define in C - but working only on types. So, essentially, you wrote Yep that's fine.. instance A (forall x.Num x = x) Yep which is not very Haskelly. Hmmm... I am simply trying to

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Luke Palmer
On Jan 10, 2008 1:25 PM, Nicholls, Mark [EMAIL PROTECTED] wrote: Thanks for your response, I think you helped me on one of my previous abberations. Hmmmthis all slightly does my head inon one hand we have typesthen type classes (which appear to be a relation defined on

RE: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Nicholls, Mark
Thanks for your response, I think you helped me on one of my previous abberations. Hmmmthis all slightly does my head inon one hand we have typesthen type classes (which appear to be a relation defined on types)then existential types...which now appear not to be treated

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Jules Bean
Nicholls, Mark wrote: Thanks for your response, I think you helped me on one of my previous abberations. Hmmmthis all slightly does my head inon one hand we have typesthen type classes (which appear to be a relation defined on types)then existential types...which now appear not

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Jules Bean
Nicholls, Mark wrote: My confusion is not between OO classes and Haskell classes, but exactly are the members of a Haskell type class...I'd naively believed them to be types (like it says on the packet!)...but now I'm not so sure. Which packet? Classes are not types. Classes are groups of

RE: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Nicholls, Mark
-Original Message- From: Jules Bean [mailto:[EMAIL PROTECTED] Sent: 10 January 2008 14:22 To: Nicholls, Mark Cc: Bulat Ziganshin; haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] confusion about 'instance' Nicholls, Mark wrote: My confusion is not between OO classes

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Tillmann Rendel
Nicholls, Mark wrote: I only have 1 type. If I say my name is mark twice, it doesn't mean I belong to set of objects called Mark twice Typeclasses define not only sets of types, but a common interface for these types, too. An analogy would be to say: I have a name, and it is Marc.

RE: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Henning Thielemann
On Thu, 10 Jan 2008, Nicholls, Mark wrote: Existential: newtype Numeric = forall a. Num a = Numeric a My compiler doesn't like this A newtype constructor cannot have an existential context, Universal: newtype Numeric' = Numeric' (forall a. Num a = a) Not so sure I understand

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Jules Bean
Nicholls, Mark wrote: Classes are groups of types. Sets of types. Classifications of types. I had them down as an n-ary relation on typessomeone's said something somewhere that's made me question that...but I think I misinterpreted themso I may default back to n-ary relation. Yes,

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Miguel Mitrofanov
If I say my name is mark twice, it doesn't mean I belong to set of objects called Mark twice Yes, but instance declaration doesn't only state that some type belongs to some class. It also provides some operations on this type. ___ Haskell-Cafe