[GHC] #12459: UnboxedTuple makes overloaded labels fail to parse

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: orf | 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: -------------------------------------+------------------------------------- [https://gist.githubusercontent.com/PkmX/bfb2c5af4317c96282795f8c588fda1c/raw... This] works (removing spaces) {{{#!hs -- user = ( #login := "themoritz", #id := 3522732 ) user :: User user = (#login := "themoritz", #id := 3522732) }}} but it doesn't when `UnboxedTuples` are enabled: {{{#!hs -- tWKw.hs:63:46: error: parse error on input ‘)’ user = (#login := "themoritz", #id := 3522732) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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 Iceland_jack): * Attachment "NamedTuple.hs" added. From https://www.reddit.com/r/haskell/comments/4w1jcr/using_typelevel_naturals_ov... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): This forces users to add a space in the ^rare^ case of mixing `UnboxedTuples` and overloaded labels. {{{#!hs main = do print $ #url mentioned print $ #login ( #user mentioned []) print $ ( #id . #user ) mentioned }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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 bgamari): * cc: adamgundry (added) Comment: Hmm, is this an interaction that you anticipated, Adam? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by rwbarton): We should probably just say this is working as intended: `(#` is a single token under `UnboxedTuples`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): I bumped into this because I have `UnboxedTuples` enabled in my ''.ghci'' but in a future where `OverloadedLabels` are ubiquitous a user cannot use unboxed tuples without modifying every parenthesised label in the module first: potentially resulting in large diffs, potentially going against the style of the project (or style guide). Not a huge concern but definitely raises an eyebrow ---- This could of course be ameliorated by ''local'' language pragmas ;) think about it (local `Strict`, `RebindableSyntax`) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by adamgundry): No, I hadn't considered the interaction with unboxed tuple syntax. It is a bit awkward, but the lexical syntax is sufficiently crowded that I doubt we will be able to do better, and we already have similar annoyances involving `.hsc` files. I suppose we could add a sentence to the manual pointing out the conflict and encouraging a style in which overloaded labels are preceded by a space (even when in parentheses). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by simonpj): Yes -- a note in the manual would be hugely helpful. Might you send a patch? Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: adamgundry Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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 adamgundry): * owner: => adamgundry * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: adamgundry Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf 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: | -------------------------------------+------------------------------------- Comment (by jberryman): Does this have much to do with overloaded labels? As rwbarton points out, it seems any occurence of "(#" has issues: {{{ ubuntu@ip-172-31-8-51:~/work/ghc-my$ ghci GHCi, version 8.1.20160920: http://www.haskell.org/ghc/ :? for help Prelude> :set -XUnboxedTuples Prelude> let (#) = (+) <interactive>:2:7: error: parse error on input ‘)’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: adamgundry Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: | Keywords: orf Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3144 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * status: new => patch * failure: GHC rejects valid program => Documentation bug * differential: => Phab:D3144 Comment: I've included a comment in my documentation updates for the recent changes to overloaded labels. The unboxed tuples docs already mention that `(#` is a single lexeme. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12459: UnboxedTuple makes overloaded labels fail to parse -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: adamgundry Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 (Parser) | Resolution: fixed | Keywords: orf Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3144 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged in 2aac0ba111e0b09b1ffe4886b4a638042aae57d4. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12459#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC