Combining ‘within’ and ‘only’ for import restrictions
neongreen opened this issue · comments
I have a module Mod, and I’m to gradually deprecate its usage.
I’d like to
- allow importing identifiers Mod.x, Mod.y everywhere in the codebase (since they don’t have replacements),
- and arbitrary imports of Mod should also be allowed within certain legacy modules.
I thought combining ‘within’ and ‘only’ would get me what I want — allow unrestricted usage within
, and only
certain identifiers otherwise — but apparently it doesn’t work.
I could just say {- HLINT ignore “Avoid restricted imports” -} instead of using within
, but it allows all restricted imports and not just one.
Is there any way to get what I want with HLint?
I think the problem is that its a bit ambiguous. Is it within the given modules you are only allowed certain identifiers, or you are allowed within the given modules or when using certain identifiers. I think people might assume both, so avoided the ambiguity. I'm not sure there is a way to do this with HLint, but must confess that the import restrictions are fairly hard to grok (partly because of this and/or behaviour).