title: How to compile an executable from Haskell Stack build?
body: <pre><code>|-aseCswk2
    |-app
      |-Main.hs
    |-src
      |-Libs.hs
    |-test
      |-Spec.hs
    |-aseCswk2.cabal
    |-Setup.hs
    |-package.yaml
  ...
  </code></pre>
  
  <p>So i have a Haskell project that uses a Stack build system and is laid out as the example above. If i use <code>$ stack test</code> then my functions in my Libs.hs file are tested with the cases in my Spec.hs file. If i use <code>$ stack build</code> then my file builds successfully and i can use the functions inside <code>$ stack ghci</code>. </p>
  
  <p>However, i want to create an executable of the my Main.hs file but don't know how this is possible. I have tried compiling it using <code>$ ghc Main.hs</code> inside the app directory but get an error saying 'Failed to load interface for Lib' even though i have included it as an import. I have also tried <code>$stack build aseCswk2:exe:aseCswk2-exe</code> but no <code>.o</code> files are created to run.</p>