<br><br><div><span class="gmail_quote">On 11/6/05, <b class="gmail_sendername">Klaus Ostermann</b> <<a href="mailto:ostermann@informatik.tu-darmstadt.de">ostermann@informatik.tu-darmstadt.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>instance Node Person where<br> isConnectedTo g n (p1,p2) = (p1 == n) || (p2 == n)<br>
</blockquote><div><br>
At this point, isConnectedTo knows nothing about the third argument
except that it is an edge, and there's no reason to think that an Edge
is a tuple. All you can say is that there are two functions, n1
and n2, which extract the nodes of the edge. Use those instead,
for example<br>
<br>
isConnectedTo g n p = n == n1 p || n == n2 p<br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Couldn't match the rigid variable `e' against `(a, b)'<br> `e' is bound by the type signature for `isConnectedTo'
<br> Expected type: e<br> Inferred type: (a, b)<br> When checking the pattern: (p1, p2)<br> In the definition of `isConnectedTo':<br> isConnectedTo g n (p1, p2) = (p1 == n) || (p2 == n)</blockquote><div><br>
Hopefully this error makes more sense now. It's saying that it expected something of type 'e', but it found a tuple.<br>
<br>
</div></div>regards,<br>
Fraser.<br>