Skip to content

`ghci` prints confusing error message if using ":m +" instead of ":load"

ghci seems to treat the ":module +" command differently from ":load", in a way that I do not understand.

If I try to load a module in the current directory, this fails:

Prelude> :m +BloomFilter
module main:BloomFilter is not loaded
Prelude> :! ls BloomFilter.hs
BloomFilter.hs

But this succeeds:

Prelude> :load BloomFilter
Ok, modules loaded: BloomFilter, BloomFilter.Mutable, BloomFilter.Internal.

I don't have a problem with the difference in behaviour, but it doesn't appear to be documented. I thus don't really know why it occurs (though I can guess), which means that I can't clearly explain it as a gotcha in the book.

Also, the the module main:BloomFilter is not loaded error message is baffling: since it doesn't tell me what is actually wrong or why, I had no idea what was occurring until I remembered the difference in behaviour between the two commands.

Turning on ":set -v" doesn't shed any more light on the failure of ":m +", so this is that much more difficult to figure out.

In general, the error messages from GHC and ghci are useful. If you could fix this one up, that would be great! Thanks.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information