[GHC] #12811: GHC tells me to use RankNTypes when it's already enabled
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I was stumped for a while today because GHC kept telling me to turn on `RankNTypes` even when it was already enabled! I eventually realized this was the problem: {{{#!hs {-# LANGUAGE RankNTypes #-} module Bug where foo :: foral a. a -> a foo x = x }}} {{{ $ ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:4:15: error: Illegal symbol '.' in type Perhaps you intended to use RankNTypes or a similar language extension to enable explicit-forall syntax: forall <tvs>. <type> }}} That is, the real culprit was misspelling `forall` as `foral`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Yes indeed. Perhaps someone can arrange to suppress the suggestion if `RankNTypes` is already on? That would help a bit, by removing the confusing suggestion. But it's hard to come up with a good error message for {{{ a b . c d }}} as a type. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #11669 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => newcomer Comment: My suggestion would be that if `RankNTypes` is already on and a user incorrectly uses a dot as above, then the error message should say something like: {{{ Perhaps you meant to write 'forall <vars> . <body>'? }}} Not the greatest error message in the world, but still better than the status quo. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: ruperthorlick Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T12811 Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): D3262 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ruperthorlick): * owner: (none) => ruperthorlick * testcase: => parser/should_fail/T12811 * differential: => D3262 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: ruperthorlick Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T12811 Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): D3262 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ruperthorlick): * status: new => patch -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: ruperthorlick Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T12811 Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): Phab:D3262 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * differential: D3262 => Phab:D3262 Comment: Thanks, Rupert! By the way, the syntax that Trac expects for Phab tickets is (somewhat annoyingly) Phab:D3262, not D3262. I went ahead and fixed it here. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: ruperthorlick Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T12811 Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): Phab:D3262 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"488a9daa8246e0dd364dc44b8b6b8650fa6f3822/ghc" 488a9daa/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="488a9daa8246e0dd364dc44b8b6b8650fa6f3822" Changed parser message for RankNTypes (#12811) Added a check for whether RankNTypes is enabled and changed error message accordingly Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D3262 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12811: GHC tells me to use RankNTypes when it's already enabled -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: ruperthorlick Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | parser/should_fail/T12811 Blocked By: | Blocking: Related Tickets: #11669 | Differential Rev(s): Phab:D3262 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.2.1 Comment: Thanks Rupert! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12811#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC