[Haskell-cafe] Fwd: how to get ghci to load compiled modules in 7.8?
qdunkan at gmail.com
Mon Jul 14 17:08:00 UTC 2014
I sent this to haskell-cafe, but there was no response. On
stackoverflow there was no response either. I'm trying one last time,
but adding ghc-users (which I should have done at the beginning!).
Surely it can't be that no one knows how to load modules in ghci? I
know a lot of work was done to enable this, as in
https://ghc.haskell.org/trac/ghc/wiki/DynamicByDefault, it seems a
waste if no one actually knows how to use it!
The 7.8.1 release notes make reference to -dynamic-too, and an
unexplained "Dynamic Ghci", but implies ghci should just work. Do I
need to compile ghci myself in a dynamic way? The DynamicByDefault
page also implies that, but I assumed the binary distributions would
come with it compiled the right way.
This has almost disabled ghci for my work (it can be used, but very
slowly and with much retyping of commands, and I find myself avoiding
the REPL now), so it's a big regression from 7.6! I added another
paragraph from the stackoverflow question. Also, I can't get this to
work on linux either, not just OS X.
BTW, I got a nice bump in my profiles after upgrading, so 7.8 is
mostly good news. Just this one awkward thing keeps it from being all
---------- Forwarded message ----------
I recently upgraded to 7.8.2 and I have a silly question. How do you
get ghci to load compiled modules? When I try this:
% cat >T.hs
module T where
x :: Int
x = 42
% ghc -c -dynamic-too T.hs
T.dyn_hi T.dyn_o T.hi T.hs T.o
GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package filepath-184.108.40.206 ... linking ... done.
Prelude> :l T
[1 of 1] Compiling T ( T.hs, interpreted )
Ok, modules loaded: T.
It still loads the file interpreted, even though there is a .dyn_o
present. What am I doing wrong?
This is on x86-64 OS X.
There is one other thing which may be related. Since I load everything
interpreted now, I've noticed that the input gets very laggy when I
have a hundred or so modules loaded. Also the haskeline state gets
confused, e.g. I hit escape k to get the previous line, but then it
spontaneously goes back into insert mode again. It stays balky and
awkward for about 15 seconds before returning to normal slightly. It's
almost as if, after loading all the bytecode, it's still doing tons of
work in the background, with constant GC freezes. But what work could
it be doing? The bytecode is loaded and I haven't asked it to do
anything yet! I don't know if this is new to 7.8, or if it's a result
of loading bytecode instead of binary.
Update: loading with -fobject-code to force compilation reduces some
of the balkiness, but some is still there! So maybe this is a
regression from 7.6?
More information about the Haskell-Cafe