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)
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
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
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 not to sell your soul to
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 y