Ticket #5385 (closed bug: fixed)

Opened 22 months ago

Last modified 22 months ago

formatting error on advice involving infix constructors

Reported by: ekmett Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.0.2
Keywords: Cc: michal.terepeta@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Difficulty:
Test Case: rename/should_fail/T5385 Blocked By:
Blocking: Related Tickets:

Description

This seems to be an instance of a larger issue involving formatting of infix type constructors, but if I write a bad import statement, ghc gives me some advice to fix it:

Text/Trifecta/Strand.hs:17:25:
    In module `Data.FingerTree':
      `:<' is a data constructor of `ViewL'
    To import it use
      `import Data.FingerTree (ViewL (:<))'
    or
      `import Data.FingerTree (ViewL (..))'

but to actually import it you need

import Data.FingerTree (ViewL ((:<)))

Attachments

Change History

Changed 22 months ago by michalt

  • status changed from new to patch

The attached patch should fix it. So now for the following code

module Test where

import Data.Sequence ( (:<) )
import Data.Tree ( Node )

we get:

[1 of 1] Compiling Test             ( Test.hs, Test.o )

Test.hs:3:24:
    In module `Data.Sequence':
      `(:<)' is a data constructor of `ViewL'
    To import it use
      `import Data.Sequence (ViewL ((:<)))'
    or
      `import Data.Sequence (ViewL (..))'

Test.hs:4:20:
    In module `Data.Tree':
      `Node' is a data constructor of `Tree'
    To import it use
      `import Data.Tree (Tree (Node))'
    or
      `import Data.Tree (Tree (..))'

Changed 22 months ago by michalt

  • cc michal.terepeta@… added

Changed 22 months ago by simonpj@…

commit d464e73b488214dba0becf039290e4b23a4c3ba2

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Aug 8 12:29:40 2011 +0100

    Use parenSymOcc when displaying an export list in RnNames (fixes Trac #5385)
    
    I also called parenSymOcc in two other places that begged for it.

 compiler/rename/RnNames.lhs |   12 +++++++-----
 compiler/types/Coercion.lhs |    6 ++----
 compiler/types/TypeRep.lhs  |    3 +--
 3 files changed, 10 insertions(+), 11 deletions(-)

Changed 22 months ago by simonpj

  • status changed from patch to closed
  • testcase set to rename/should_fail/T5385
  • resolution set to fixed

Thank you! In the end I made a new patch becuase there's a function to do exatly the job. But I appreciate you making the patch -- thanks.

Simon

Changed 22 months ago by michalt

Great! I knew that somewhere there should be a function to do that, but I somehow haven't noticed it.. ;-) Thanks!

Note: See TracTickets for help on using tickets.