Search code examples
haskellimporterrorghci

Could not load my own modules in ghci haskell


i am trying to load a module called Point.hs into a file called Circle.hs by this way:

module Figures.Circle 
( Circle(..)
  , getArea
  , getPerimeter
) where

import qualified Figures.Point as P

here is my Point.hs file:

 module Figures.Point  
( Point(..)  
) where  

this is my directory´s tree:

  • Figures/
    • Point.hs
    • Circle.hs

and this is what ghci´s error says:

Circle.hs:7:1: error:
    Could not find module `Figures.Point'
    Locations searched:
      Figures\Point.hs
      Figures\Point.lhs
      Figures\Point.hsig
      Figures\Point.lhsig
  |
7 | import qualified Figures.Point as P

I follow this guide.


Solution

  • I get the same error if I call ghci from within the Figures directory, that can be avoided by calling ghci from the parent directory, so ghci Figures\Circle.hs.