[GHC] #10056: Inconsistent precedence of ~

GHC ghc-devs at haskell.org
Tue Aug 4 03:05:24 UTC 2015


#10056: Inconsistent precedence of ~
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
  (Parser)                           |
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:  #10059            |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 What exactly ''should'' the precedence of `(~)` be, anyway? It definitely
 seems like it should be lower than most things, but how low? For example,
 should this:

 {{{#!hs
 f :: (Int -> Int ~ Int -> Int) => String
 }}}

 parse as this?

 {{{#!hs
 f :: ((Int -> Int) ~ (Int -> Int)) => String
 }}}

 Also, I'm not sure that I understand this concern:

 > Should `(~)` be imported as part of the Prelude? If no, then a lot of
 code breaks. If yes, that implies that hiding the `Prelude` also hides
 `(~)`, breaking less code, but still breaking code.

 Does hiding `Prelude` necessarily mean that `(~)` won't be visible? I was
 under the impression that certain types would still be visible even if
 `Prelude` was hidden, e.g., `(->)`. Couldn't we make `(~)` another such
 type and sidestep that issue?

 As for the `LANGUAGE` pragma question, I think it would make sense for
 `TypeOperators` to enable use of `(~)`. I would keep `TypeFamilies` and
 `GADTs`' ability to enable use of `(~)` to avoid breaking code
 unnecessarily—perhaps a warning can be emitted if `(~)` is used in the
 presence of `TypeFamilies` or `GADTs` but not `TypeOperators`?

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


More information about the ghc-tickets mailing list