Solve the problem in ghci : attempting to use module ... which is not loaded
更新日期:
文章目錄
Problem
I am reading Learn you a Haskell for great Good and I faced the problem of “attempting to use module … which is not loaded” when I am at the end of chapter module, finally I got the solution on it
Steps of Solution
- Load the source code
- Set the module to Prelude
- Import the modules
Load the source code
Compile the source code into the GHCI
1 | *Geometry.Cuboid> :l Geometry/Cube.hs Geometry/Sphere.hs |
Set the module to Prelude
Change back the current module in the GHCI to Prelude, by default the last module loaded becomes the current module.
1 | *Geometry.Cube> :module Prelude |
Import the modules
Import the modules we just loaded in the GHCI, and you can see the qualified name of the module will be append into the namespace.
1 | Prelude> import qualified Geometry.Sphere as Sphere |