[Haskell-beginners] Using GHCi, import submodule that needs to import another submodule?

Daniel Trstenjak daniel.trstenjak at gmail.com
Wed Mar 5 19:18:36 UTC 2014


Hi James,

> So import still does not work.  But by trying “:load" from the parent
> directory, I was able to load Sphere, Cube and Cuboid.  The problem is
> that it appears that only one is available at a time (i.e. loading
> Cube displaces Sphere). What’s more there is no way to do qualified
> imports.

Sorry about this one. 'import' depends on the available/installed ghc packages,
the given module name 'Geometry.Sphere' is looked up in these packages.

Calling 'ghc-pkg list' will give you a list of all packages.

If you don't have created and installed a package for your geometry
files, then ghci will not know them.

So calling ':load/:add' is the right thing here.


Greetings,
Daniel


More information about the Beginners mailing list