[Haskell-cafe] possible bug in default module lookup scheme / or invalid haskell?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sun Jul 18 01:45:57 EDT 2010


Carter Schonwald <carter.schonwald at gmail.com> writes:

> Hello All, I'm not sure if this either a bug in how ghc does path/module
> lookup or  it simply is invalid haskell:
>
>
> consider modules A, A.B and A.B.C
> where  A imports A.B, and A.B imports A.B.C
> with the following file system layout
>
> A.hs
> A/B.hs
> A/B/C.hs
>
> minimal file examples:
> module A where
> import A.B
>  testA = "will it really really work?
> ------------
> module A.B where
> import A.B.C
>  testB = "will it work
> -----------------
> module A.B.C where
> testC = "will this work?"
> ----------
> if i run ghci A.hs everything's fine
> but if in directory B i rune ghci B.hs,  i get
> A/B.hs:2:8:
>     Could not find module `A.B.C':
>       Use -v to see a list of the files searched for.
>
> -----------
> it seems to me that if the default search path for ghc(i) includes the
> current directory (which according to docs it does), this shouldn't be
> happening.  (or is there some why this is good Behavior?)

I think ghci is just not smart enough to know that it should change to
the parent directory and run it from there.  As such, it's trying to
find "A.B.C" from the context of the current directory, and the file is
not in A/A/B/C.hs so it can't find it.

So it's just a limitation of ghci (I think).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list