title: Why is it possible to build a Haskell program with .hs files that fail to compile individually?
body: <p>I am relatively new to Haskell and the compile/build process. I cloned a Haskell package from Github that builds using a cabal file. I can build the program no problem using <code>stack build</code>, <code>stack install</code> etc. </p>
  
  <p>Currently I am interested in using the functions in only the Rewrite.hs file in the Haskell package, but I cannot successfully compile it by importing Rewrite to my own Main.hs and calling <code>ghc Main.hs</code>. I get the following type errors:</p>
  
  <pre><code>Rewrite.hs:73:13: error:
      • Expecting one more argument to ‘Module’
        Expected a type, but ‘Module’ has kind ‘* -&gt; *’
      • In the type signature:
          stripTop :: Module -&gt; Module
  
  Rewrite.hs:16:29: error:
      • Expecting one more argument to ‘Pat’
        Expected a type, but ‘Pat’ has kind ‘* -&gt; *’
      • In the type signature:
          findPats :: Data a =&gt; a -&gt; [Pat]
  </code></pre>
  
  <p>I thought that building a package basically compiles and links files together - Why is it possible to have compiler errors for parts of a program when compiling by hand? Alternatively, should I not be attempting to use a .hs file from a part of a program like this?</p>
  
  <p>EDITED:</p>
  
  <p>The package is <a href="https://github.com/Genetic-Strictness/Autobahn" rel="nofollow noreferrer">https://github.com/Genetic-Strictness/Autobahn</a></p>
  
  <p>An example of Main:</p>
  
  <pre><code>import Rewrite
  import System.FilePath
  import Language.Haskell.Exts
  
  file ::FilePath
  file = "test.hs"
  
  main = placesToStrict file
  </code></pre>
  
  <p>where the function <code>placesToStrict</code> is from Rewrite which calls on <code>findPats</code>, which causes the compiler errors above.</p>