GHCi complains about main not being
in scope when I load a module.
You probably omitted the module
declaration at the top of the module, which causes the
module name to default to Main. In
Haskell, the Main module must define a
function called main. Admittedly this
doesn't make a great deal of sense for an interpreter, but
the rule was kept for compatibility with GHC.
The interpreter can't load modules with foreign export
Unfortunately not. We haven't implemented it yet.
Please compile any offending modules by hand before loading
them into GHCi.
-O doesn't work with GHCi!
For technical reasons, the bytecode compiler doesn't
interact well with one of the optimisation passes, so we
have disabled optimisation when using the interpreter. This
isn't a great loss: you'll get a much bigger win by
compiling the bits of your code that need to go fast, rather
than interpreting them with optimisation turned on.
Unboxed tuples don't work with GHCi
That's right. You can always compile a module that
uses unboxed tuples and load it into GHCi, however.
(Incidentally the previous point, namely that
-O is incompatible with GHCi, is because
the bytecode compiler can't deal with unboxed
Concurrent threads don't carry on running when GHCi is
waiting for input.
No, they don't. This is because the Haskell binding
to the GNU readline library doesn't support reading from the
terminal in a non-blocking way, which is required to work
properly with GHC's concurrency model.
After using getContents, I can't use
stdin again until I do
:load or :reload.
This is the defined behaviour of
getContents: it puts the stdin Handle in
a state known as semi-closed, wherein
any further I/O operations on it are forbidden. Because I/O
state is retained between computations, the semi-closed
state persists until the next :load or
You can make stdin reset itself
after every evaluation by giving GHCi the command
:set +r. This works because
stdin is just a top-level expression that
can be reverted to its unevaluated state in the same way as
any other top-level expression (CAF).