ndmitchell / hlint

Haskell source code suggestions
Other
1.48k stars 195 forks source link

Combining ‘within’ and ‘only’ for import restrictions #1546

Open neongreen opened 1 year ago

neongreen commented 1 year ago

I have a module Mod, and I’m to gradually deprecate its usage.

I’d like to

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?

ndmitchell commented 10 months ago

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).