
18 Dec
2007
18 Dec
'07
5:03 a.m.
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