Alias Current Module with `as` and Allow `qualified` definitions

I briefly searched in ghc proposals for aliasing the current module with as (same as imports) but did not find matching proposals.

There is a package Imp that allows for aliasing the current module so it seems like there is a demand.

Could the below be useful

module Current.Module qualified as This ( -- qualified and as could be used independently
  This.function,
  anotherFunction,
  This.SomeType(..),
  AnotherType(..),
  ) where
-- imported functions and types are used much more than the defined ones
import Another.Module (function, anotherFunction)
3 Likes

BTW Did you see the date of that post?

It”s not an April fools day post, if that’s what you’re implying. Imp really exists, and it has that feature.

2 Likes

Thanks, I could see Imp really exists. Some April Fool’s posts go to extraordinary lengths to make themselves seem plausible.

What made me suspect it’s a spoof is the thin motivation:

If you later refactor this module by changing its name, you’ll also have to update any qualified identifiers.

Because an editor isn’t capable of making a global change?

My now-deleted first post (written before I’d spotted the April 1st) asked why you wouldn’t just make your own names different to stuff in the Prelude? Because anybody who imports your module is going to suffer the clash also. I then saw the date and thought d’uh I’ve fallen for it.

Frankly I never expected it to see any use, but I did write this “local” quasiquoter when I was playing around with TH. You can rename it to this and get [this|name|] if you fancy.

2 Likes