
6 Nov
2005
6 Nov
'05
11:30 a.m.
Daniel Fischer schrieb:
I'd prefer (very strongly) something like
class Graph g n e | g -> n, g -> e where isConnectedTo :: g -> n -> e -> Bool -- or perhaps rather without "g" startNode, endNode :: e -> n . . . -- other Methods of interest like nodes, edges, components . . .
with, e.g.
instance Graph (Map node [node]) node (node,node) where . . .
Thanks for the suggestion. This looks good, but it seems as if the "g" needs to occur in every signature, otherwise the interpreter throws a "No instance for ... arising from ..." error if you want to apply the function. Hence startNode would need to be startNode :: g -> e -> n rather than startNode :: e -> n Is there any way to get rid of this dummy argument? Klaus