Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The issue is the same as discussed below, the flags changed:</p> <pre class="lang-none prettyprint-override"><code>~/.../Util&gt; ghc Other.hs [1 of 1] Compiling Util.Other ( Other.hs, Other.o ) ~/.../Util&gt; cd .. ~/.../src&gt; ghc MyFile.hs [1 of 2] Compiling Util.Other ( Util/Other.hs, Util/Other.o ) [flags changed] [2 of 2] Compiling MyFile ( MyFile.hs, MyFile.o ) </code></pre> <p>I haven't found out which flags in particular, or why the flags passed during separate compilation are different than the ones that are passed when compiling as a module chased from the importing module, but they do change, and hence a recompilation is necessary (Specifically, the flag-hash value in the <code>.hi</code> file changes).</p> <p>The fix is therefore to not compile the modules separately, but to compile them as dependencies of the top-level importer.</p> <hr> <p>Original almost correct guesswork:</p> <p>I can only partly reproduce that. After compiling and then <code>touch</code>ing <code>MyFile.hs</code>,</p> <pre class="lang-none prettyprint-override"><code>$ ghci-7.4.2 MyFile.hs -- snip [1 of 2] Compiling Util.Other ( Util/Other.hs, interpreted ) [2 of 2] Compiling MyFile ( MyFile.hs, interpreted ) Ok, modules loaded: MyFile, Util.Other. </code></pre> <p>it looks the same as for you, but with 7.6.1, we get a hint (compiling and <code>touch</code>ing):</p> <pre class="lang-none prettyprint-override"><code>$ ghci MyFile.hs -- snip [1 of 2] Compiling Util.Other ( Util/Other.hs, interpreted ) [flags changed] [2 of 2] Compiling MyFile ( MyFile.hs, interpreted ) Ok, modules loaded: MyFile, Util.Other. </code></pre> <p>The flags changed. I have <code>:set -XNoMonomorphismRestriction</code> in my <code>.ghci</code> file, and the change of flags causes the recompilation.</p> <pre class="lang-none prettyprint-override"><code>$ ghci -ignore-dot-ghci MyFile.hs GHCi, version 7.6.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. [2 of 2] Compiling MyFile ( MyFile.hs, interpreted ) Ok, modules loaded: MyFile, Util.Other. </code></pre> <p>Ignoring the offending <code>.ghci</code> with the flag that wasn't given for the compilation, the unchanged <code>Util.Other</code> is not interpreted, the compiled code is used. (With GHC &lt; 7.4, ignoring the <code>.ghci</code> file isn't even necessary.)</p> <p>If you have a <code>.ghci</code> file in which you set language options (<code>NoMonomorphismRestriction</code>, <code>TypeFamilies</code>, ...) and ghc >= 7.4, you need to ignore the <code>.ghci</code> file when loading the modules.</p> <p>If that is not the case, the recompilation is not the expected behaviour. Then more information would be necessary to diagnose the problem and find a fix.</p> <p>A semi-work-around would then be the <code>-fobject-code</code> flag for ghci.</p>
 

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