On 11/6/05, Klaus Ostermann <[EMAIL PROTECTED]> wrote:

instance Node Person where
   isConnectedTo g n (p1,p2) = (p1 == n) || (p2 == n)

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

isConnectedTo g n p = n == n1 p || n == n2 p

  Couldn't match the rigid variable `e' against `(a, b)'
    `e' is bound by the type signature for `isConnectedTo'
    Expected type: e
    Inferred type: (a, b)
  When checking the pattern: (p1, p2)
  In the definition of `isConnectedTo':
      isConnectedTo g n (p1, p2) = (p1 == n) || (p2 == n)

Hopefully this error makes more sense now.  It's saying that it expected something of type 'e', but it found a tuple.

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

Reply via email to