title: Trouble calling a Haskell function from the main module
body: <p>I've defined a function called <code>findPaths</code> in a Haskell Module called BinaryTree and I am trying to call that function in the main module I've created. The type of the function call is</p>
  
  <pre><code>findPaths :: Tree -&gt; [Path]
  </code></pre>
  
  <p>Where <code>Tree</code> is a data type defined as:</p>
  
  <pre><code>data Tree = Leaf | Node Tree Tree</code></pre>
  
  <p>and <code>Path</code> is defined as:</p>
  
  <pre><code>data Path = LeftTurn Path | RightTurn Path | This
  </code></pre>
  
  <p>In the main function I'm doing this and only this:</p>
  
  <pre><code>module Main where
  import BinaryTree
  findPaths (Node Leaf Leaf)
  </code></pre>
  
  <p>But when I try and compile this with the following command:</p>
  
  <p><code>ghc -o --make Main Main.hs BinaryTree.hs</code></p>
  
  <p>I get this error:</p>
  
  <pre>Couldn't match expected type `Language.Haskell.TH.Syntax.Q
                                      [Language.Haskell.TH.Syntax.Dec]'
  against inferred type `[Path]'
  In the expression: findPaths (Node Leaf Leaf)</pre>
  
  <p>I get the same error if I try to export the data types in the BinaryTree module:</p>
  
  <pre><code>module BinaryTree (Tree(..), Path(..), allPaths) where...
  </code></pre>
  
  <p>I'm at a loss... I don't know what I'm doing wrong. Suggestions, no matter how straight forward and obvious are greatly welcome. Thank you.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thank you, all of you, for your help.</p>
  
  <p>@Travis Aside from what everyone suggested I ended up doing this last night before I read your message:</p>
  
  <pre><code>import BinaryTree
  
  main = do
      print (findPaths (Node Leaf Leaf))
  </code></pre>
  
  <p>It works the way I expected it to. But in the future, I'll make sure I follow the proper semantics you referenced me. </p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I had responded last night with some other answers but apparently there was a <a href="https://meta.stackexchange.com/questions/67088/downtime-alert">power outage</a> and 4 hours worth of answers and questions were lost. Thought maybe I had dreamt answering those questions. Good to know I'm not crazy.</p>