
Hello, I have the following structure:
MyProgram/A.hs MyProgram/Aux/B.hs MyProgram/Aux/C.hs
and:
A imports C B imports C
Can I make this work using namespaces only (i.e. no -i flag)? I expected this to work:
MyProgram/A.hs name: A import Aux.C MyProgram/Aux/B.hs name: Aux.B import C MyProgram/Aux/C.hs name: Aux.C
But complains when importing C from B since its name is Aux.C. What is the most elegant way to deal with such cases? J.A.

On Wed, May 19, 2004 at 08:13:11PM +0100, Jorge Adriano Aires wrote:
MyProgram/A.hs name: A import Aux.C MyProgram/Aux/B.hs name: Aux.B import C MyProgram/Aux/C.hs name: Aux.C
But complains when importing C from B since its name is Aux.C. What is the most elegant way to deal with such cases?
The heirarchical module names are always "full paths" to the module. Aux.B still needs to refer to Aux.C. This is annoying if you want to move something into a different place, since it will refer to itself entirely using the full names. The description of the Heirarchical module standard suggests that they are open to ideas for improvement :-) Dave Brown

On Wed, May 19, 2004 at 08:13:11PM +0100, Jorge Adriano Aires wrote:
MyProgram/A.hs name: A import Aux.C MyProgram/Aux/B.hs name: Aux.B import C MyProgram/Aux/C.hs name: Aux.C
But complains when importing C from B since its name is Aux.C. What is the most elegant way to deal with such cases?
The heirarchical module names are always "full paths" to the module. Aux.B still needs to refer to Aux.C.
This is annoying if you want to move something into a different place, since it will refer to itself entirely using the full names.
The description of the Heirarchical module standard suggests that they are open to ideas for improvement :-)
Yeap got it. At first I did use "import Aux.C" but then I was trying to load B using ghci from MyProgram/Aux. That didn't work because it expected C to be in an Aux subdir. That confused me, but now it's obvious, I have to run ghci from the "root" of my program. Thanks! J.A.

I expected this to work:
MyProgram/A.hs name: A import Aux.C MyProgram/Aux/B.hs name: Aux.B import C MyProgram/Aux/C.hs name: Aux.C
But complains when importing C from B since its name is Aux.C. What is the most elegant way to deal with such cases?
Answering myself, this works:
MyProgram/A.hs name: A import Aux.C MyProgram/Aux/B.hs name: Aux.B import Aux.C MyProgram/Aux/C.hs name: Aux.C
I just have to load B from MyProgram when testing it in ghci, instead of loading it in MyProgram/Aux. Thanks to Lunar for the tip. J.A.

Jorge Adriano Aires
I have the following structure:
MyProgram/A.hs MyProgram/Aux/B.hs MyProgram/Aux/C.hs
You have already received replies to your question, so let me make a different point. If you ever intend your program to work on Windows, do not use "Aux" as a file or directory name! The libraries mailing list has some recent experience of this. (Apparently "Aux" is a reserved filename on Windows and you get strange behaviour if you try to use it for anything else.) Regards, Malcolm

Jorge Adriano Aires
writes: I have the following structure:
MyProgram/A.hs MyProgram/Aux/B.hs MyProgram/Aux/C.hs
You have already received replies to your question, so let me make a different point. If you ever intend your program to work on Windows, do not use "Aux" as a file or directory name! The libraries mailing list has some recent experience of this. (Apparently "Aux" is a reserved filename on Windows and you get strange behaviour if you try to use it for anything else.)
Thanks for the tip, I'm working in linux though and Aux was really just an example :) J.A.
participants (3)
-
David Brown
-
Jorge Adriano Aires
-
Malcolm Wallace