
| It would be useful to be able to do a | | module Doc.Pretty.Long.Name where | | import Doc.Pretty.Long.Name as This | | so within the module we can refer to itself as 'This' without having to | write out the full name, however ghc complains that the hi file for the | module it is trying to compile is not available. It would be nice if ghc | could recognize the self-import case and handle it directly. I quite liked this idea until I thought of this: module Doc.Pretty.Long( M.f, f ) where import qualified M( f ) import Doc.Pretty.Long as M f x = x The second import decl imports all the things exported by Doc.Pretty.Long. But what does it export? Well, M.f. But what is M.f. Well, it could be the f coming from 'import M.f'. But wait! Doc.Pretty.Long exports the locally-defined f too... and the second import decl will make that be called M.f too. It seems that we may need a fixpoint loop to sort all this out. Seems scary. I think what you want is actually more directly stated thus: module Doc.Pretty.Long( ... ) as M where ... The 'as M' in the module header gives an alias for Doc.Pretty.Long just as it does for an import statement. Simple. Your scheme had the advantage of no new syntax. I'd be interested to know whether lots of people would like 'as M' in the module header, as new syntax. A bit more complexity, but perhaps useful. Simon