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

GHC ghc-devs at haskell.org
Sat Jan 24 23:43:21 UTC 2015


#10018: Cannot define custom fixity for infix data constructors in GHCi
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  RyanGlScott                        |            Status:  new
                  Type:  bug         |         Milestone:
              Priority:  normal      |           Version:  7.8.4
             Component:  GHCi        |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Incorrect result
          Architecture:              |  at runtime
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 When compiling from a module, declaring a custom fixity for an infix data
 constructor is valid:

 {{{#!hs
 module DataFixity where

 data Infix a b = a :@: b
 infixl 4 :@:
 }}}

 And GHCi recognizes this:

 {{{
 $ ghci DataFixity.hs
 GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling DataFixity       ( DataFixity.hs, interpreted )
 Ok, modules loaded: DataFixity.
 λ> :i :@:
 data Infix a b = a :@: b        -- Defined at DataFixity.hs:3:18
 infixl 4 :@:
 }}}

 However, one cannot do this entirely in GHCi:
 {{{
 $ ghci
 GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 λ> data Infix a b = a :@: b; infixl 4 :@:
 λ> :i (:@:)
 data Infix a b = a :@: b        -- Defined at <interactive>:2:18
 }}}

 GHCi simply assumes {{{:@:}}} has the default infix precedence.

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


More information about the ghc-tickets mailing list