[GHC] #10522: Add UInfixT, like UInfixE or UInfixP but for types
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.10.1 Component: Template | Operating System: Unknown/Multiple Haskell | Type of failure: None/Unknown Keywords: | Blocked By: Architecture: | Related Tickets: Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- TemplateHaskell provides [https://hackage.haskell.org/package/template- haskell-2.10.0.0/docs/Language-Haskell-TH-Syntax.html#infix UInfixE and UInfixP] for punting fixity handling of infix operators in expressions and patterns. There doesn't seem to be an equivalent for type operators in TH's [https://hackage.haskell.org/package/template-haskell-2.10.0.0/docs /Language-Haskell-TH-Syntax.html#t:Type type representation], but it would be nice to have one. (In fact, it doesn't appear possible to implement this manually, either, as the TemplateHaskell doesn't expose fixity information at all for type operators, at least as far as I can tell.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * keywords: => newcomer Comment: Happy to support a newcomer in addressing this deficiency. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by spinda): For reference: the (one-line) implementation of [https://github.com/ghc/ghc/blob/master/compiler/hsSyn/Convert.hs#L920 UInfixP] and the corresponding "[https://github.com/ghc/ghc/blob/master/compiler/hsSyn/Convert.hs#L739-L768 Converting UInfix]" note. Addressing this looks fairly straightforward. (1) Add a new {{{UInfixT Type Name Type}}} data constructor to the declaration of [https://github.com/ghc/ghc/blob/master/libraries/template- haskell/Language/Haskell/TH/Syntax.hs#L1464-L1483 Language.Haskell.TH.Syntax.Type]. (2) Add a new branch to [https://github.com/ghc/ghc/blob/058af6c90a0e8d122f2d1339b6b4fd0b5ec83d05/com... cvtTypeKind] with a one-to-one conversion to [https://downloads.haskell.org/~ghc/latest/docs/html/libraries/ghc/HsTypes.ht... HsOpTy]. Then the renamer already handles [https://github.com/ghc/ghc/blob/058af6c90a0e8d122f2d1339b6b4fd0b5ec83d05/com... restructuring the tree]. I'll try my hand at it myself when I get the time, if no one has taken it up by then. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Without looking at the code myself, this sounds entirely reasonable to me. Thanks! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1088 -------------------------------------+------------------------------------- Changes (by spinda): * owner: => spinda * differential: => Phab:D1088 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1088 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"217827393dcacd0ef696c4f9f6136e21b3be63a8/ghc" 2178273/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="217827393dcacd0ef696c4f9f6136e21b3be63a8" Add UInfixT to TH types (fixes #10522) UInfixT is like UInfixE or UInfixP but for types. Template Haskell splices can use it to punt fixity handling to GHC when constructing types. UInfixT is converted in compiler/hsSyn/Convert to a right-biased tree of HsOpTy, which is already rearranged in compiler/rename/RnTypes to match operator fixities. This patch consists of (1) adding UInfixT to the AST, (2) implementing the conversion and updating relevant comments, (3) updating pretty-printing and library support, and (4) adding tests. Test Plan: validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1088 GHC Trac Issues: #10522 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10522: Add UInfixT, like UInfixE or UInfixP but for types -------------------------------------+------------------------------------- Reporter: spinda | Owner: spinda Type: feature request | Status: closed Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.1 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1088 -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10522#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC