[Haskell-beginners] Module import problem

Chry Cheng chrycheng at gmail.com
Sun Sep 28 12:08:23 EDT 2008


"Casey Rodarmor" <caseyrodarmor at gmail.com> writes:

> Hi there!
>
> I have a problem with importing a module I'd like to use.
>
> My working directory, ~/proj, contains:
>    ./Haskore -- a folder containing a version of haskore, this music thingy
>    ./test.hs -- random stuff using haskore
>
> The main file in ~/proj/Haskore is ~/proj/Haskore/Haskore.hs, which
> contains the following module declaration:
>> module Haskore(module HaskoreLoader) where
>> import HaskoreLoader
>
> I've tried to put all the following in ~/proj/test.hs, with no luck:
>> import Haskore         -- Could not find module `Haskore':
>> import Haskore.Haskore -- file name does not match module name `Haskore'
>
> Am I doing something wrong? Is there a way to place a module in an
> arbitrary directory, without having to modify it?
>
> Thanks so much for your help!
>
> Best,
> Casey Rodarmor
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

You have to tell GHC where to find Haskore.  To do this, call ghc with the i option:

ghc -iHaskore/

then, import using:

import Haskore


More information about the Beginners mailing list