me2
me2

Reputation: 3119

Haskell tool to rewrite import statements to name all imports?

While writing Haskell code, I often simply type

import System.Environment
import System.Directory

Is there a tool available that will amend these import statements and add the function names I actually use back into the import statements? Such as:

import System.Environment (getArgs)
import System.Directory (getDirectoryContents)

Thanks.

Upvotes: 7

Views: 244

Answers (1)

Greg Bacon
Greg Bacon

Reputation: 139411

Use ghc's -ddump-minimal-imports flag. For an example, see Cleaning up your Haskell imports on my blog.

Upvotes: 16

Related Questions