[GHC] #11452: Typed Template Haskell sneakily allows impredicativity
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 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: -------------------------------------+------------------------------------- The following module is accepted: {{{#!hs {-# LANGUAGE ExplicitForAll, TemplateHaskell #-} module Bug where impred :: forall a. a -> a impred = $$( [|| \x -> x ||] ) }}} But that requires an intermediate `TExp (forall a. a -> a)`. Will fix in ongoing work. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: 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): Actually, my original example is OK; that's not impredicative, because the `a` can be bound outside the splice. But the following is accepted and really is impredicative: {{{#!hs {-# LANGUAGE RankNTypes, TemplateHaskell #-} module Bug where impred :: (forall a. a -> a) -> () impred = $$( [|| \_ -> () ||] ) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: 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:"00cbbab3362578df44851442408a8b91a2a769fa/ghc" 00cbbab3/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="00cbbab3362578df44851442408a8b91a2a769fa" Refactor the typechecker to use ExpTypes. The idea here is described in [wiki:Typechecker]. Briefly, this refactor keeps solid track of "synthesis" mode vs "checking" in GHC's bidirectional type-checking algorithm. When in synthesis mode, the expected type is just an IORef to write to. In addition, this patch does a significant reworking of RebindableSyntax, allowing much more freedom in the types of the rebindable operators. For example, we can now have `negate :: Int -> Bool` and `(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic is in tcSyntaxOp. This addresses tickets #11397, #11452, and #11458. Tests: typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458} th/T11452 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11452 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => merge * testcase: => th/T11452 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11452 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11452 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Merged to `ghc-8.0` as 278e1fa2fd7b33254e323d394706e72f4664ad02 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11452: Typed Template Haskell sneakily allows impredicativity -------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Resolution: fixed | Keywords: | TypedTemplateHaskell Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: th/T11452 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * keywords: => TypedTemplateHaskell -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11452#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC