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

Terrible failure of type inference in visible type application
Consider ``` -- optIntArg :: (Maybe Int -> t2) -> (t2,t2) optIntArg f = (f Nothing, f (Just True)) ``` This is rejected (by HEAD) ``` T11379a.hs:5:30: error: * Couldn't match type `a' with `Bool' `a' is a rigid type variable bound by a type expected by the context: forall a. Maybe a at T11379a.hs:5:30 Expected type: forall a. Maybe a Actual type: Maybe Bool * In the first argument of `f', namely `(Just True)' In the expression: f (Just True) In the expression: (f Nothing, f (Just True)) ``` but if you put the tuple components the other way round, it works fine ``` optIntArg f = (f (Just True), f Nothing) ``` Adding the commented-out signature also makes it work fine. I'm almost certain that this is caused by visible type application; perhaps `Nothing` gets delayed instantiation, and then `f`'s type becomes `forall a. Maybe a`. Utterly bogus. I suspect it'll be fixed by Richards `ReturnTv` work, but let's make sure it is. We can't release this!! <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ----------------------- | | Version | 7.10.3 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | highest | | Resolution | Unresolved | | Component | Compiler (Type checker) | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"Terrible failure of type inference in visible type application","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.0.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider\r\n{{{\r\n-- optIntArg :: (Maybe Int -> t2) -> (t2,t2)\r\noptIntArg f = (f Nothing, f (Just True))\r\n}}}\r\nThis is rejected (by HEAD)\r\n{{{\r\nT11379a.hs:5:30: error:\r\n * Couldn't match type `a' with `Bool'\r\n `a' is a rigid type variable bound by\r\n a type expected by the context:\r\n forall a. Maybe a\r\n at T11379a.hs:5:30\r\n Expected type: forall a. Maybe a\r\n Actual type: Maybe Bool\r\n * In the first argument of `f', namely `(Just True)'\r\n In the expression: f (Just True)\r\n In the expression: (f Nothing, f (Just True))\r\n}}}\r\nbut if you put the tuple components the other way round, it works fine\r\n{{{\r\noptIntArg f = (f (Just True), f Nothing)\r\n}}}\r\nAdding the commented-out signature also makes it work fine.\r\n\r\nI'm almost certain that this is caused by visible type application; perhaps `Nothing` gets delayed instantiation, and then `f`'s type becomes `forall a. Maybe a`. Utterly bogus.\r\n\r\nI suspect it'll be fixed by Richards `ReturnTv` work, but let's make sure it is. We can't release this!!\r\n","type_of_failure":"OtherFailure","blocking":[]} -->
issue