Miguel Mitrofanov wrote:
class Shape a where {

   intersect :: Shape b => a -> b -> Bool

}

data Shape a = { intersect :: Shape b => a -> b -> Bool }

in fact, the syntax is rather similar, too! :)



Um, well, and how are you going to implement it?


Yes, exactly.

My only point is

There is no difference!

There is no difference between the manual dictionary approach and the typeclass approach, in terms of ease of implementing a binary function. Each one has the same fundamental problem: binary functions are much easier with the ADT approach.

Incidentally, my type sig was wrong, sorry:

data Shape a  = { intersect :: a -> Shape b -> Bool }

Jules

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to