All of us love to read explicit import lists (especially in an unknown module), but we all hate to write and maintain them.
>From our point of view, it is obligatory for any code that goes into production to have only explicit imports. That way, the code is easier to comprehend – no one is confused about the location of a stray type or identifier, even when reading from GitHub or a simple editor. There are, however, usability and maintainability issues with explicit imports, which make enforcing explicit imports in style guides a topic for discussion. To enjoy the benefits of explicit imports while keeping the drawbacks in check, we have implemented *Importify*. *Importify* is a tool developed by Serokell tooling team led by Dmitry Kovalnikov. It is a refactoring tool that helps import management in Haskell code. We’re getting close to releasing it on Hackage, but it requires some polishing. You can contribute to Importify <https://github.com/serokell/importify/issues?q=is%3Aissue+is%3Aopen+label%3Ahacktoberfest> and Serokell’s own custom Prelude Universum <https://github.com/serokell/universum/issues?q=is%3Aissue+is%3Aopen+label%3Ahacktoberfest> during Hacktoberfest <https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest> . *Importify* is all about decluttering the import blocks. It can remove: - unused symbols in explicit import lists - unused qualified imports - unused implicit imports - unnecessarily hidden symbols Highlights of the functionality of *Importify* are that it works deeply with explicit import lists (it can, for instance, remove unused constructors), and it works with hiding imports. The latter feature isn’t present in any open-source refactoring tool that is known to us. It is also compatible with autoexporter <https://hackage.haskell.org/package/autoexporter>. *Importify *works extremely well with large Haskell projects — we use it to great success to clean up Cardano SL <https://github.com/input-output-hk/cardano-sl/>. Importify only parses source code instead of building projects. For a project of the size of Cardano SL it takes only two minutes to build Importify cache while building it would take forty minutes on the same machine. In the future, we plan for *Importify *to be able to add used symbols to imports automatically. To speed up *Importify *runs, we will implement a cache server that caches each Hackage package. You will be able to upload caches for your projects there as well. Next on the roadmap is functionality to convert imports between *implicit* and *explicit*, and between *qualified* and *unqualified* forms. Finally, we will be adding functionality to resolve merge conflicts in import section automatically. If you notice that managing imports becomes a slog, feel free to try this tool out yourself. Spotted a bug? Contact us. <b...@serokell.io> To those, who are in the mood for some hacking this Autumn, we’re looking forward to your #Hacktoberfest contributions!
_______________________________________________ Haskell mailing list Haskell@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell