om-plugin-imports: Plugin-based import warnings

[ compiler-plugin, library, mit ] [ Propose Tags ]

This is a plutin that acts similar to `-ddump-minimal-imports`, but the style of imports dumped to the dump directory is better. Where "better" means it will satisfy `-Wmissing-import-lists` (which `-ddump-minimal-imports does not always), and it will omit the explicit import list for imports that are already qualified. The files are dumped to dump-dir/module-name.full-imports. No files will be dumped unless `-dumpdir` is explicitly passed by the user.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.2.0.0, 0.2.0.0.9.6
Dependencies base (>=4.16 && <4.17), containers (>=0.6.4.1 && <0.7), ghc (>=9.2.0 && <9.3), om-plugin-imports [details]
License MIT
Copyright 2022 Rick Owens
Author Rick Owens
Maintainer rick@owensmurray.com
Category Compiler Plugin
Home page https://github.com/owensmurray/om-plugin-imports
Uploaded by rickowens at 2022-11-25T02:22:56Z
Distributions
Executables om-import-warnings-test
Downloads 224 total (31 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-11-25 [all 1 reports]

Readme for om-plugin-imports-0.1.0.1

[back to package description]

om-plugin-imports

This plugin behaves similarly to the native GHC options -ddump-minimal-imports. If (and only if) you specify a -dumpdir directory to GHC, this plugin will emit files to that directory that contain a normalized, complete set of explicit imports for your module. This is sort of what -ddump-minimal-imports does, but -ddump-minimal-imports has the following deficiencies:

  • It will not always produce output that satisfies -Wmissing-import-lists. E.g. it will sometimes produce something like:

    import Foo (Bar(..))
    
  • It will explicitly import all the names from modules which are already qualified, E.g:

    import qualified Foo as F (foo, bar, baz)
    

This plugin solves these problems. It will dump a file in the user-supplied -dumpdir of the form <dumpdir>/<module-name>.full-imports. The file will contain a set of imports which can be copy/pasted over the imports in your module in a way that satisfies -Wmissing-import-lists.