#7476: -ddump-minimal-imports confused if first line is an import
Reporter:  dag               |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:                    |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
 On reddit, Chris Done posted this example:

 chris@midnight:~$ cat > x.hs
 import Control.Applicative
 main = show <$> pure 1 >>= print
 chris@midnight:~$ ghc x.hs -ddump-minimal-imports
 [1 of 1] Compiling Main             ( x.hs, x.o )
 Linking x ...
 cachris@midnight:~$ cat Main.imports
 import Control.Applicative
     ( print, (>>=), show, Applicative(pure), (<$>) )

 I noted that this is wrong, for example {{{print}}} isn't exported from

 >>> import Control.Applicative (print)

     Module `Control.Applicative' does not export `print'

 hvr explains: ''for some reason GHC gets confused if the very first string
 in the .hs file is import; try adding anything, such as a newline or
 module Main where and it works as expected...''

 I couldn't find a relevant bug for this.

Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7476>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

Glasgow-haskell-bugs mailing list

Reply via email to