[Haskell-cafe] Hierarchical modules issue

Ivan Miljenovic ivan.miljenovic at gmail.com
Mon Jul 19 00:37:49 EDT 2010


On 19 July 2010 14:31, Jonathan Geddes <geddes.jonathan at gmail.com> wrote:
> Now when I'm working in a subdirectory, say Foo where the modules are
> named Foo.Bar, Foo.Baz, Foo.etc., and I try to compile Bar.hs which
> imports Foo.Baz, the compiler looks for the file Foo/Baz.hs. The
> problem is that I'm already in the directory Foo and so the compiler
> fails to find the file for the module Foo.Baz. If I compile the whole
> project from the root project directory where the main file is, the
> compiler finds every module just fine.

A similar query was just asked:
http://www.haskell.org/pipermail/haskell-cafe/2010-July/080523.html

> It seams very strange to me that when the compiler is compiling a
> module named Foo.Bar and there is an import for Foo.Baz, the compiler
> doesn't look in the directory where Foo.Bar is located (the current
> dir)!

Run ghc[i] from the root (source) directory of your project, not
within the hierarchy (note that haskell-mode for emacs tries to do
this by finding where the .cabal file is, etc.).

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


More information about the Haskell-Cafe mailing list