sort-imports

Sort Haskell import statements

Install

git clone https://github.com/evanrelf/sort-imports.git
cd sort-imports
stack install

Usage

Takes input on stdin or with --file 'path/to/file.hs', and outputs to stdout. For example:

sort-imports < input.hs > output.hs

input.hs:

module Main where

import qualified ModuleC as C
import ModuleD ((>>=), function, Type(..))
import ModuleA
import ModuleB hiding (aaa, ccc, bbb)

import AnotherModuleB
import AnotherModuleC
import AnotherModuleA

main :: IO ()
main = putStrLn "Hello world"

output.hs:

module Main where

import ModuleA
import ModuleB hiding (aaa, bbb, ccc)
import qualified ModuleC as C
import ModuleD (Type(..), function, (>>=))

import AnotherModuleA
import AnotherModuleB
import AnotherModuleC

main :: IO ()
main = putStrLn "Hello world"

Type sort-imports --help for more information.

Editor integration

Vim/Neovim

Description
No description provided
Readme 45 KiB
Languages
Haskell 100%