[GHC] #12427: Type inference regression with RankNTypes (GHC 8.1)

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 (Type checker) | Keywords: RankNTypes | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following module compiles fine with ghc-8.0.1: {{{#!hs {-# LANGUAGE RankNTypes #-} module Acquire where newtype Acquire a = Acquire {unAcquire :: (forall b. b -> b) -> IO a} instance Functor Acquire where fmap = undefined instance Applicative Acquire where pure = undefined (<*>) = undefined instance Monad Acquire where Acquire f >>= g' = Acquire $ \restore -> do x <- f restore let Acquire g = g' x -- let g = unAcquire (g' x) g restore }}} HEAD (83e4f49577665278fe08fbaafe2239553f3c448e, ghc-8.1.20160720) reports: {{{ Acquire.hs:17:21: error: • Couldn't match expected type ‘t’ with actual type ‘(forall b1. b1 -> b1) -> IO b’ ‘t’ is a rigid type variable bound by the inferred type of g :: t at Acquire.hs:17:13-28 • In the pattern: Acquire g In a pattern binding: Acquire g = g' x In the expression: do { x <- f restore; let Acquire g = g' x; g restore } • Relevant bindings include g' :: a -> Acquire b (bound at Acquire.hs:15:19) (>>=) :: Acquire a -> (a -> Acquire b) -> Acquire b (bound at Acquire.hs:15:15) }}} This example is reduced from the `recourcet` package on Hackage, module `Data.Acquire.Internal`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * cc: erikd (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #12431 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: bgamari, simonpj (added) * priority: normal => highest * related: => #12431 * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #12431 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * cc: slyfox, osa1 (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #12431 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): ghc-HEAD from Feb 2016: {{{ commit 62d1888ff45bd817409be2c3eacdc86cfef4bed8 Date: Thu Feb 11 11:00:24 2016 +0000 }}} typechecked the example above. I'll try to bisect. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #12431 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): No don't bother, thank you! I'm on this: `wip/spj-tc-branch`. (But I'm heavily distracted at the moment.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12427: Type inference regression with RankNTypes (GHC 8.1)
-------------------------------------+-------------------------------------
Reporter: thomie | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 8.2.1
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords: RankNTypes
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #12431 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#12427: Type inference regression with RankNTypes (GHC 8.1) -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: fixed | Keywords: RankNTypes Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | typecheck/should_compile/T12427a, b Blocked By: | Blocking: Related Tickets: #12431 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_compile/T12427a, b * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12427#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC