[GHC] #5712: Can't define constructors to be infix (as far as Show is concerned) with GADT syntax

GHC cvs-ghc at haskell.org
Fri Sep 7 13:36:40 CEST 2012


#5712: Can't define constructors to be infix (as far as Show is concerned) with
GADT syntax
----------------------------------------+-----------------------------------
  Reporter:  benmachine                 |          Owner:                  
      Type:  feature request            |         Status:  closed          
  Priority:  normal                     |      Milestone:                  
 Component:  Compiler                   |        Version:  7.3             
Resolution:  fixed                      |       Keywords:                  
        Os:  Unknown/Multiple           |   Architecture:  Unknown/Multiple
   Failure:  Other                      |     Difficulty:  Unknown         
  Testcase:  deriving/should_run/T5712  |      Blockedby:                  
  Blocking:                             |        Related:                  
----------------------------------------+-----------------------------------

Comment(by maeder):

 Well, two arguments are needed to print an infix at all, but the first
 part could be relaxed, too, since

 {{{
 data T a = a `T` a deriving Show
 }}}

 also prints values as infix. (I did not test ghc-7.6.1 yet, if it also
 looks for a fixity declaration of plain constructors.)

 I just see ":info" in ghci-7.4.2 omits the required backticks:

 {{{
 *Main> :i T
 data T a = a `T` a      -- Defined at T.hs:5:6
 infixl 6 T
 instance Show a => Show (T a) -- Defined at T.hs:5:29
 }}}

 And, a "infixl 9" declaration is omitted (since this is the default).

 I rather think, "deriving Show" takes the data declaration too literal.
 All my shown values change if I switch to record syntax (of course without
 infix), just to get cheap selectors (although record syntax may be more
 readable).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5712#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list