Skip to content

GHCi erroneously unloads modules after a failed :reload


Say you have three modules:

module Main where

import Foo
import Bar
module Foo where
module Bar where

And you run the following in GHCi:

:load Main
:! echo '"' >> Bar.hs # alter Bar in such a way that it fails to compile
:reload

What I expect to have happened is that Bar fails to compile and so does Main (because Main imports Bar), thus Bar and Main should get unloaded. So in the end Foo should be the only module left loaded.

What I've observed is that not only do Bar and Main get unloaded, but Foo does too! Yet Foo should not get unloaded because it has been altered.

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