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

GHC cvs-ghc at haskell.org
Sun Dec 18 21:10:49 CET 2011


#5712: Can't define constructors to be infix (as far as Show is concerned) with
GADT syntax
------------------------------+---------------------------------------------
 Reporter:  benmachine        |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.3               |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  Other             |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 Okay so, if you define a data type like this:

 {{{
 data Two a = a :. a deriving Show
 }}}
 then `show (1 :. 2) == "1 :. 2"`. On the other hand, if you define the
 data type like so:
 {{{
 data Two a = (:.) a a deriving Show
 }}}
 then `show (1 :. 2) == "(:.) 1 2".

 This kind of makes sense since how the constructor is defined by the user
 gives some hint as to how it should be used. The only problem is you can't
 give that hint if you're using GADT syntax, since then constructors are
 given without explicit arguments.

 I don't see an easy way to let you give that hint, but I think it would be
 reasonable to just guess that any constructor with a symbol name (i.e. one
 starting with `:`) should be considered infix.

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



More information about the Glasgow-haskell-bugs mailing list