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

Anthony Cowley acowley at seas.upenn.edu
Sun Jul 18 14:18:03 EDT 2010

On Sun, Jul 18, 2010 at 1:55 PM, Carter Schonwald
<carter.schonwald at gmail.com> wrote:
> I'm not sure I follow, because the toy example I'm asking about does in fact
> use hierarchical module names...
> are you proposing that a reasonable workaround in my use case is to do
> :cd ..
> :r
> this seems like a reasonableish approach, or was there a different example
> you had in mind?

Yes, that is what I had in mind. The typical scenario for me is to be
editing a file in emacs, C-c-C-l it, and have GHCi complain. I then
issue a ":cd .." in GHCi, and my subsequent loads are properly rooted
at top of the project directory.

What I was trying to describe as unwanted is for someone to take your
toy example and, in the file A/B.hs have a line "import B.C" that is
gets correctly resolved by GHC. I'm not sure that you were actually
suggesting this, but this kind of leniency on the part of GHC (or
GHCi) would make the file B.hs fragile with respect to moving it
around on disk.


> On Sun, Jul 18, 2010 at 1:34 PM, Anthony Cowley <acowley at seas.upenn.edu>
> wrote:
>> On Sun, Jul 18, 2010 at 3:59 AM, Carter Schonwald
>> <carter.schonwald at gmail.com> wrote:
>> > I don't think that semantics creates the sort of ambiguity that Kevin is
>> > concerned about, and while yes there simple alternative approaches, they
>> > require whatever is starting up ghci to know what the correct directory
>> > to
>> > pass to the -i flag, and that seems a bit of a heavy weight expectation
>> I usually use ghci's :cd command in this situation, and wouldn't want
>> to think about changing source files depending on where they were on
>> disk.
>> While having to use fully hierarchical names might seem verbose, I
>> have found it to be a very predictable mechanism that makes managing
>> large-ish projects easier.
>> Anthony
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list