[GHC] #10018: Cannot define custom fixity for infix data constructors in GHCi

GHC ghc-devs at haskell.org
Wed Feb 11 19:33:04 UTC 2015


#10018: Cannot define custom fixity for infix data constructors in GHCi
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  GHCi              |                 Version:  7.10.1-rc2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  closed => new
 * version:  7.8.4 => 7.10.1-rc2
 * resolution:  fixed =>


Comment:

 Sorry, it turns out that the bug is more nuanced than I thought. I
 prematurely closed this ticket when I discovered that a {{{deriving
 Show}}} clause does in fact pick up on a custom fixity:

 {{{
 $ ghci
 GHCi, version 7.10.0.20150123: http://www.haskell.org/ghc/  :? for help
 λ> data Infix a b = a :@: b deriving Show; infix 4 :@:
 λ> showsPrec 4 ('a' :@: 'b') ""
 "'a' :@: 'b'"
 λ> showsPrec 5 ('a' :@: 'b') ""
 "('a' :@: 'b')"
 }}}

 So as far as {{{Show}}} is concerned, {{{:@:}}} is {{{infix 4}}}. However,
 it behaves as {{{infixl 11}}} when it is actually used:

 {{{
 λ> 'a' :@: 'b' :@: 'c'
 ('a' :@: 'b') :@: 'c'
 }}}

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


More information about the ghc-tickets mailing list