[GHC] #11458: Terrible failure of type inference in visible type application

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.10.3 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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!! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: => goldfire * keywords: => TypeApplications -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Yes. This is a `ReturnTv` problem. Fix is nearly done -- I'm just going through the testsuite today. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11458: Terrible failure of type inference in visible type application
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: goldfire
Type: bug | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler (Type | Version: 7.10.3
checker) | Keywords:
Resolution: | TypeApplications
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_compile/T11458 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge * testcase: => typecheck/should_compile/T11458 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_compile/T11458 Blocked By: | Blocking: Related Tickets: #11397 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Lemming): * related: => #11397 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11458: Terrible failure of type inference in visible type application -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.10.3 checker) | Keywords: Resolution: fixed | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_compile/T11458 Blocked By: | Blocking: Related Tickets: #11397 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: This was merged in 278e1fa2fd7b33254e323d394706e72f4664ad02. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11458#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC