The importify package

[ Tags: development, library, mit, program, refactoring ] [ Propose Tags ]

Please see

[Skip to Readme]


Versions 1.0, 1.0.1
Change log
Dependencies aeson, aeson-pretty, autoexporter, base (>=4.7 && <5), bytestring, Cabal, containers, filepath, fmt, foldl, hashable, haskell-names, haskell-src-exts, hse-cpp, importify, log-warper (>=1.8.2), microlens-platform, optparse-applicative, path, path-io, pretty-simple, syb, template-haskell, text, text-format, turtle, universum (>=1.0.0), unordered-containers, yaml [details]
License MIT
Copyright 2017 Serokell
Author @serokell
Maintainer Serokell <>
Category Development, Refactoring
Home page
Bug tracker
Source repository head: git clone
Uploaded Sat Dec 23 10:48:53 UTC 2017 by shersh
Distributions LTSHaskell:1.0.1, NixOS:1.0.1
Executables golden-generator, importify
Downloads 215 total (183 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-12-23 [all 3 reports]
Hackage Matrix CI


  • Extended
    • System
      • Extended.System.Wlog
  • Importify
    • Importify.Cabal
      • Importify.Cabal.Extension
      • Importify.Cabal.Module
      • Importify.Cabal.Package
      • Importify.Cabal.Target
    • Importify.Environment
    • Importify.Main
      • Importify.Main.Cache
      • Importify.Main.File
    • Importify.ParseException
    • Importify.Path
    • Importify.Preprocessor
    • Importify.Pretty
    • Importify.Resolution
      • Importify.Resolution.Explicit
      • Importify.Resolution.Hiding
      • Importify.Resolution.Implicit
      • Importify.Resolution.Qualified
    • Importify.Stack
    • Importify.Syntax
      • Importify.Syntax.Import
      • Importify.Syntax.Module
      • Importify.Syntax.Scoped
      • Importify.Syntax.Text
    • Importify.Tree


Maintainer's Corner

For package maintainers and hackage trustees

Readme for importify-1.0.1

[back to package description]

importify — manage Haskell imports quickly

Build Status Hackage Stackage Nightly Stackage LTS HLint Status License: MIT

Importify in a nutshell.

importify tool helps you to manage the import section of your Haskell project modules. GHC compiler can warn you about unused imports, and it's a good practice to remove such imports immediately. But this becomes tedious, especially if you use explicit import lists.

Importify can remove unused imports automatically.

Before importify | After importify :---------------:|:-----------------: Module with imports mess | After removing all unused imports

You can use stylish-haskell after importify to prettify imports.

In the future, we plan for Importify to be able to:

  • Add missing imports automatically, so you won't have to manage imports manually at all.
  • Implement a cache server with the following features:
    • Download caches for Hackage packages to speed up Importify runs.
    • Upload your caches for yet-to-be-published FOSS projects to make it easier to collaborate.
    • Query mappings from any module of every package to symbols exported by it to write your refactoring tools.
  • Convert imports between implicit and explicit, and between qualified and unqualified forms.
  • Resolve merge conflicts in import section automatically. See an example of such conflict.


Installation process assumes that you have already installed and configured stack build tool. Currently importify works only with projects built with stack.

Installing from Stackage

Install just as every usual package.

stack install importify

Installing from source

Perform the next steps before driving:

git clone  # 1. Clone repository locally
cd importify                                         # 2. Step into folder
stack install importify\:exe\:importify              # 3. Copy executable under ~/.local/bin


In short:

$ cd my-project-which-build-with-stack
$ importify cache
$ importify file path/to/File/With/Unused/Imports.hs

importify has several commands. Most important is

importify --help

Before removing redundant imports run importify cache command. Importify stores local cache for the project under the .importify folder inside your project. This cache stores exported entities for each module for every dependency and for all your local packages. Make sure to re-run importify cache if you change the list of exported functions and types in your project modules. Cache is built incrementally; it builds dependencies only once. But if you add dependencies or use other versions of them (for instance, because of bumping stack lts) you need to run importify cache again. You can always perform rm -rf .importify before caching if you face any troubles.

After the cache is built, you can use importify file PATH_TO_FILE command from your project root directory. This command runs Importify on the file and prints the result in the terminal. If you want to change a file in-place use the following command:

importify file -i PATH_TO_FILE