Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Henning Thielemann
On Thu, 31 May 2007, Stefan Holdermans wrote: > Mingli, > > > > class Lattice e where > > > join :: e -> e -> e > > > meet :: e -> e -> e > > > > > > -- associative law > > > join x (join y z) = join (join x y) z > > > join (join x y) z = join x (join y z) > > If you are

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Thomas Schilling
On 5/31/07, Stefan Holdermans <[EMAIL PROTECTED]> wrote: Dan, > If you want to enforce associativity just create your own Eq > instance and > make it a pattern there. Could you elaborate on that? It's still early here and I've had only one cup of of coffee yet. Cheers, Stefan QuickCheck

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Stefan Holdermans
Dan, If you want to enforce associativity just create your own Eq instance and make it a pattern there. Could you elaborate on that? It's still early here and I've had only one cup of of coffee yet. Cheers, Stefan ___ Haskell-Cafe mailing li

Re: [Haskell-cafe] equations and patterns

2007-05-31 Thread Dan Mead
If you want to enforce associativity just create your own Eq instance and make it a pattern there. Initially when I started doing Haskell it seemed that you could just type an equation of constructors and have it enforced as a rule. This actually isn't the case (someone correct me if I'm wrong) b

Re: [Haskell-cafe] equations and patterns

2007-05-30 Thread Stefan Holdermans
Mingli, > class Lattice e where > join :: e -> e -> e > meet :: e -> e -> e > > -- associative law > join x (join y z) = join (join x y) z > join (join x y) z = join x (join y z) If you are not to sell your soul to advanced and perhaps obscure type hacking, you cann

[Haskell-cafe] equations and patterns

2007-05-30 Thread mingli yuan
Hi, buddies. I am a newbie on Haskell. Recently I want to implement a simple Lattice in Haskell, but I met some difficulties. Scrap of the code is as below, but I met syntax error: class Lattice e where join :: e -> e -> e meet :: e -> e -> e -- associative law join x (join