title: Couldn't match expected type with actual type
body: <p>I've recently started learning Haskell and is having trouble figuring out what is wrong with my code but ended up in failure.</p>
  
  <p>This is part of my code showing that I've declared data Constructor for Graph type, which is a list of tuple of a value and a list of that value.</p>
  
  <pre><code>data Graph a = Graph [(a,[a])] deriving (Ord, Eq, Show)
  </code></pre>
  
  <p>This is type synonym for tuple of two ints, </p>
  
  <pre><code>type Point = (Int, Int)
  </code></pre>
  
  <p>And finally this code is to find second argument of a graph using first argument(i.e searching / hashing value)</p>
  
  <pre><code>pointNeighbor :: Graph Point -&gt; Point -&gt; [Point]
  pointNeighbor (x:xs) point = if fst x == point then snd x else pointNeighbor (xs) point
  </code></pre>
  
  <p>This is the error message I get when I try to load module</p>
  
  <blockquote>
    <p>hw1.hs:37:16:
        Couldn't match expected type ‘Graph Point’
                    with actual type ‘[(Point, [Point])]’
        In the pattern: x : xs
        In an equation for ‘pointNeighbor’:
            pointNeighbor (x : xs) point
              = if fst x == point then snd x else pointNeighbor (xs) point</p>
    
    <p>hw1.hs:37:79:
        Couldn't match expected type ‘Graph Point’
                    with actual type ‘[(Point, [Point])]’
        In the first argument of ‘pointNeighbor’, namely ‘(xs)’
        In the expression: pointNeighbor (xs) point</p>
  </blockquote>
  
  <p>It seems like Graph Point should be recognized as [(Point,[Point])] but apparently it is giving me this error and I can't find any solution on web. </p>
  
  <p>Thanks in advance :)</p>