Assume this situation
Test/ Foo.hs <- this is module Test.Foo Bar.hs <- this is module Test.Bar
Test.Foo imports Test.Bar
If I cd into Test, and do ghci Bar.hs everything is fine, module Test.Bar is loaded.
If I do ghci Foo.hs it complains about not being able to find Test.Bar.
My request is that ghci looks "up" in the hierarchy and assumes that the user wants too look for modules in .. if the module Test.Foo lies in the file Foo.hs
Of course this will not always work, symlinks and other things, but it would be useful. Now I have to do "cd ..; ghci -i. Test.Foo" instead.
I'm sceptical about this feature. As Hal mentioned, you can always do 'ghci -i.. Foo.hs', but even that is slightly dodgy because then you have two overlapping directories on the import path. The reason you can use Foo.hs is because it is a root module, and root modules are allowed to have filenames which differ from their module names. Suppose you try to refer to it as simply "Foo", making sure we're in a different directory entirely: $ cd <elsewhere>; ghci -i<path>/Test Foo ... <path>/Test/Foo.hs: file name does not match module name `Foo' The only "right" way to use a hierarchical module is from the root of the tree. Cheers, Simon
participants (1)
-
Simon Marlow