Ticket #1792 (closed bug: fixed)

Opened 6 years ago

Last modified 4 years ago

-ddump-minimal-imports breaks qualified imports (import...as)

Reported by: guest Owned by:
Priority: low Milestone: 6.12 branch
Component: Compiler Version: 6.6.1
Keywords: Cc: aslatter@…, gwern0@…, fasta
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: T1792_imports Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj) (diff)

When using the -ddump-minimal-imports option on a Haskell file, it breaks qualified imports.

Ie, suppose one has a line in a file thus:

 import qualified Data.ByteString as B (putStr, readFile)

Using -ddump-minimal-imports will give you something like this:

 import Data.ByteString(B.putStr, B.readFile)

There are 3 things wrong here:

  • putStr and readFile should not be renamed thus, as obviously Data.ByteString has nothing under those names
  • Data.ByteString is no longer being imported under a different name, so all function uses relying on B.putStr etc. will break
  • Finally, it's just ugly to have no spaces between the last letter of the module's name and the opening parenthesis.

I see this behavior under GHC 6.6.1, and asl of #haskell tells me he duplicated the import problem using GHCi version 6.8.0.20071019.

-- gwern

Change History

Changed 6 years ago by guest

  • cc aslatter@… added

Example program:

module Main where

import System
import qualified Data.ByteString as B

f .>> g = \x -> f x >>= g

main = getArgs >>=
          ((sequence .) $ map (B.readFile .>> B.putStr))

-ddump-minimal-imports produces:

import System(getArgs)
import Data.ByteString(B.putStr, B.readFile)

which should read:

import System(getArgs)
import qualified Data.ByteString as B(B.putStr, B.readFile)

Changed 6 years ago by simonpj

  • priority changed from normal to low
  • description modified (diff)
  • milestone set to 6.10 branch

Good point. This is one of those fiddly things, and few people use it. So I'm going to put it as low priority, currently provisionally in the 6.10 queue.

Others: pls yell and add yourselves to the cc list if you use -ddump-minimal-imports.

Simon

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 4 years ago by igloo

  • milestone changed from 6.10 branch to 6.12 branch

Changed 4 years ago by guest

  • cc gwern0@… added

Changed 4 years ago by fasta

  • cc fasta added

Changed 4 years ago by igloo

  • status changed from new to closed
  • testcase set to T1792_imports
  • resolution set to fixed

Fixed by:

Mon Jul  6 12:25:03 BST 2009  simonpj@microsoft.com
  * Major patch to fix reporting of unused imports
Note: See TracTickets for help on using tickets.