Aliasing current module qualifier

Herbert Valerio Riedel hvriedel at
Mon Sep 29 08:48:26 UTC 2014

On 2014-09-29 at 10:43:28 +0200, Andreas Abel wrote:
> Indeed, being able to introduce a short name for the current module,
> or having a fixed short name like 'This' or 'Self' would be neat.
> The standard workaround for your example would be
>   import Prelude hiding (length,null)

That won't work though, because what I failed to mention is that I
needed this (while avoiding CPP) to cope with external modules growing
their exports lists, such as Data.Foldable starting to export 'length'
and 'null' in base-

Moreover, hiding a non-existent symbol is a warning in recent GHC's but
a hard error in older GHCs, so that's not an option either if you want
to avoid CPP, support GHCs back to 7.0, and be -Werror-clean.

More generally, 'hiding'-imports aren't robust in terms of

> Did you try a .hs-boot file with your self-import trick?

Not yet

More information about the ghc-devs mailing list