Skip to content

getMinimalImports does not consolidate imports from the same module

Motivation

Currently, if I try to get the minimal imports for

module Duplicated where

import Data.Char (isDigit)
import Data.Char (isPrint)
import Data.Char (isLetter)

test x = isDigit x || isLetter x

I get the equivalent of

module Duplicated where

import Data.Char ( isDigit )
import Data.Char ( isLetter )

test x = isDigit x || isLetter x

which is not incorrect, but would be better as the equivalent of

module Duplicated where

import Data.Char ( isDigit, isLetter )

test x = isDigit x || isLetter x

This may be trickier to do than it looks at first, because you need to handle mixtures of qualified and unqualified imports from the same module, for example, which currently works OK; and there is probably some fiddling to be done with annotions.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information