[GHC] #11355: TypeApplications + RankNTypes permits "impredicativity"
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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: -------------------------------------+------------------------------------- I was slightly surprised to discover that the combination of `TypeApplications` and `RankNTypes` allows impredicative instantiations, for example: {{{#!hs map @(forall a . a) :: ((forall a. a) -> b) -> [forall a. a] -> [b] }}} Is this desirable, or should it require `ImpredicativeTypes`? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: TypeInType 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): * keywords: => TypeInType -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: | 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 goldfire): * owner: => goldfire * keywords: TypeInType => TypeApplications Comment: This is not desirable. I think I see why this happens, and I have a fix, but I actually can't reproduce. Do you have a minimal complete test case? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: | 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 adamgundry): I see, the above works with the `:t` command in GHCi, but trying to evaluate it or compile it in a module gives this error: {{{ • Illegal polymorphic or qualified type: forall a1. a1 -> a1 GHC doesn't yet support impredicative polymorphism • When checking the inferred type t :: forall b. ((forall a. a -> a) -> b) -> [forall a. a -> a] -> [b] }}} Should this message mention `ImpredicativeTypes`? In theory, it ought to be possible to actually use `ImpredicativeTypes` now if you insert enough type applications. However, the following example compiles, and I think it shouldn't: {{{#!hs {-# LANGUAGE RankNTypes, TypeApplications #-} module T11355 where t = map @(forall a . a -> a) ($ True) [id] }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: | 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 <eir@…>): In [changeset:"e6ca93005bc3df62619f3f968fe51b380e33938a/ghc" e6ca9300/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e6ca93005bc3df62619f3f968fe51b380e33938a" Fix #11355. Previously, the check for impredicative type applications was in the wrong spot. Test case: typecheck/should_fail/T11355 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: merge Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T11355 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * testcase: => typecheck/should_fail/T11355 * status: new => merge * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: merge Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T11355 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Cherry-picked to `ghc-8.0` as d4661c1adc732b12d39a6aab4a3f5a8c61e27dde. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11355: TypeApplications + RankNTypes permits "impredicativity" -------------------------------------+------------------------------------- Reporter: adamgundry | Owner: goldfire Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_fail/T11355 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11355#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC