hlint icon indicating copy to clipboard operation
hlint copied to clipboard

Add `typeApplications` option for restricted functions

Open terror opened this issue 2 months ago • 0 comments

Resolves: https://github.com/ndmitchell/hlint/issues/1637

This diff adds a typeApplications option to function restrictions, allowing users to require or forbid visible type arguments on specific functions. The primary use case is enforcing refactor-safe usage of polymorphic functions like fromIntegral and show, where implicit type inference can silently produce incorrect behaviour after type changes.

E.g., you're now able to specify:

- functions:
  - {name: fromIntegral, typeApplications: required}
  - {name: show, typeApplications: required}

Where fromIntegral x will be flagged with "Use visible type application", while fromIntegral @Int @Int64 x will be accepted. The option also supports forbidden for cases where type applications should be disallowed.

terror avatar Dec 04 '25 19:12 terror