Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

GHCi's claim of infixr 0 (->) is a lie
Currently, if you query the `:info` for `(->)` in GHCi, it will give you: ``` $ ghci GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/ryanglscott/.ghci λ> :i (->) data (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’ infixr 0 `(->)` <instances elided> ``` This fixity information appears to be plain wrong, as the following program demonstrates: ```hs {-# LANGUAGE TypeOperators #-} module Bug where import Data.Type.Equality type (~>) = (->) infixr 0 ~> f :: (a ~> b -> c) :~: (a ~> (b -> c)) f = Refl ``` Since `(~>)` and `(->)` are both `infixr 0`, I would expect `a ~> b -> c` to associate as `a ~> (b -> c)`, like the type signature for `f` wants to prove. However, GHC believes otherwise: ``` $ ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:10:5: error: • Occurs check: cannot construct the infinite type: a ~ a ~> b Expected type: ((a ~> b) -> c) :~: (a ~> (b -> c)) Actual type: ((a ~> b) -> c) :~: ((a ~> b) -> c) • In the expression: Refl In an equation for ‘f’: f = Refl • Relevant bindings include f :: ((a ~> b) -> c) :~: (a ~> (b -> c)) (bound at Bug.hs:10:1) | 10 | f = Refl | ^^^^ ``` Reading the error message above, it appears that GHC gives `(->)` an even //lower// precedence than 0, since it associates `a ~> b -> c` as `(a ~> b) -> c`. I'm not sure how to reconcile these two facts. There are at least a couple of options I can think of: 1. Claim `(->)` has a negative fixity. 1. Try to change GHC so that `(->)` really is `infixr 0`. <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ------------ | | Version | 8.4.3 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"GHCi's claim of infixr 0 (->) is a lie","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Currently, if you query the `:info` for `(->)` in GHCi, it will give you:\r\n\r\n{{{\r\n$ ghci\r\nGHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/ryanglscott/.ghci\r\nλ> :i (->)\r\ndata (->) (a :: TYPE q) (b :: TYPE r) -- Defined in ‘GHC.Prim’\r\ninfixr 0 `(->)`\r\n<instances elided>\r\n}}}\r\n\r\nThis fixity information appears to be plain wrong, as the following program demonstrates:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Type.Equality\r\n\r\ntype (~>) = (->)\r\ninfixr 0 ~>\r\n\r\nf :: (a ~> b -> c) :~: (a ~> (b -> c))\r\nf = Refl\r\n}}}\r\n\r\nSince `(~>)` and `(->)` are both `infixr 0`, I would expect `a ~> b -> c` to associate as `a ~> (b -> c)`, like the type signature for `f` wants to prove. However, GHC believes otherwise:\r\n\r\n{{{\r\n$ ghc Bug.hs \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o ) \r\n \r\nBug.hs:10:5: error: \r\n • Occurs check: cannot construct the infinite type: a ~ a ~> b \r\n Expected type: ((a ~> b) -> c) :~: (a ~> (b -> c))\r\n Actual type: ((a ~> b) -> c) :~: ((a ~> b) -> c)\r\n • In the expression: Refl\r\n In an equation for ‘f’: f = Refl\r\n • Relevant bindings include\r\n f :: ((a ~> b) -> c) :~: (a ~> (b -> c)) (bound at Bug.hs:10:1)\r\n |\r\n10 | f = Refl\r\n | ^^^^\r\n}}}\r\n\r\nReading the error message above, it appears that GHC gives `(->)` an even //lower// precedence than 0, since it associates `a ~> b -> c` as `(a ~> b) -> c`.\r\n\r\nI'm not sure how to reconcile these two facts. There are at least a couple of options I can think of:\r\n\r\n1. Claim `(->)` has a negative fixity.\r\n2. Try to change GHC so that `(->)` really is `infixr 0`.","type_of_failure":"OtherFailure","blocking":[]} -->
issue