Note that there are some explanatory texts on larger screens.

plurals
  1. POHaskell GHCI not loading compiled object file
    primarykey
    data
    text
    <p>I would like GHCI to load the compiled object code for a module which when compiled is significantly faster than the none compiled version. This was working well when all of the files were in the same directory (no module hierarchies). However, they do not work when the files are in module hierarchies.</p> <p>Working version MyFile.hs:</p> <pre><code>import Basic import Histogram </code></pre> <p>where Basic.o and Histogram.o are in the same directory as MyFile.hs</p> <p>Not Working version MyFile.hs:</p> <pre><code>import Util.Basic import Util.Histogram </code></pre> <p>where Basic.o and Histogram.o are in a subdirectory Util. With this version I get the following when loading MyFile.hs:</p> <pre><code>[1 of 2] Compiling Util.Basic ( Util/Basic.hs, interpreted ) [2 of 2] Compiling Util.Histogram ( Util/Histogram.hs, interpreted ) Ok, modules loaded: Util.Basic, Util.Histogram. </code></pre> <p>I would like to be able to organize my code in modules but still receive the benefits from using the compiled o files.</p> <p>Also, it should be noted that the source files have not been changed since the o files were compiled.</p> <p>Edits: Here are the contents of each file:</p> <p>MyFile.hs</p> <pre><code>import Util.Basic import Util.Histogram </code></pre> <p>Util/Basic.hs</p> <pre><code>module Util.Basic () where </code></pre> <p>Util/Histogram.hs</p> <pre><code>module Util.Histogram () where </code></pre> <p>Files / Compilation:</p> <pre><code>$:~/programming/haskell/example-error$ ls MyFile.hs MyFile.hs~ Util $:~/programming/haskell/example-error$ cd Util $:~/programming/haskell/example-error/Util$ ls Basic.hs Basic.hs~ Histogram.hs Histogram.hs~ $:~/programming/haskell/example-error/Util$ ghc *.hs [1 of 2] Compiling Util.Histogram ( Histogram.hs, Histogram.o ) [2 of 2] Compiling Util.Basic ( Basic.hs, Basic.o ) $:~/programming/haskell/example-error/Util$ ls Basic.hi Basic.hs~ Histogram.hi Histogram.hs~ Basic.hs Basic.o Histogram.hs Histogram.o $:~/programming/haskell/example-error/Util$ cd ../ $:~/programming/haskell/example-error$ ghci -ignore-dot-ghci MyFile.hs GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 3] Compiling Util.Histogram ( Util/Histogram.hs, interpreted ) [2 of 3] Compiling Util.Basic ( Util/Basic.hs, interpreted ) [3 of 3] Compiling Main ( MyFile.hs, interpreted ) Ok, modules loaded: Util.Basic, Util.Histogram, Main. *Main&gt; </code></pre> <p>The Solution that worked as suggested by Daniel:</p> <pre><code>The fix is to compile the importing file, and the files in the subdirectory only as a consequence of that, not directly. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload