[GHC] #11046: lookupTypeName does not support type operators

#11046: lookupTypeName does not support type operators -------------------------------------+------------------------------------- Reporter: oerjan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 7.10.2 Haskell | Keywords: | 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: -------------------------------------+------------------------------------- The following non-working code (minus a missing import) was [http://stackoverflow.com/questions/33465109/template-haskell-how-to- lookup-type-operator-name posted on stackoverflow]: `IssueTH.hs`: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module IssueTH where import Language.Haskell.TH f :: Q [Dec] f = do Just n <- lookupTypeName "GHC.TypeLits.*" return [] }}} `Issue.hs`: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module Issue where import IssueTH import GHC.TypeLits $f }}} `ghc Issue.hs` fails with message: `Pattern match failure in do expression at IssueTH.hs:7:5-10` This gives no error if `*` is replaced by an alphanumeric type like `Nat`. Similar tests seem to fail whenever attempting to look up a type operator with `lookupTypeName`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators -------------------------------------+------------------------------------- Reporter: oerjan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: 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 oerjan): On a hunch I did a further test: `lookupTypeName` ''does'' work with a type operator if it starts with `:`. A bit more flexible test file: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module IssueTH where import Language.Haskell.TH f :: String -> Q [Dec] f n = do Just n <- lookupTypeName n return [] }}} And then in GHCi: {{{ *IssueTH> :set -XTypeOperators *IssueTH> :set -XTemplateHaskell *IssueTH> data a :& b = A *IssueTH> data a & b = B *IssueTH> data Dummy; $(f ":&") *IssueTH> data Dummy; $(f "&") <interactive>:7:15: Pattern match failure in do expression at IssueTH.hs:9:5-10 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: 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: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: 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 vagarenko): * cc: vagarenko (added) * priority: normal => high * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with :
-------------------------------------+-------------------------------------
Reporter: oerjan | Owner:
Type: bug | Status: new
Priority: high | Milestone: 8.0.1
Component: Template Haskell | Version: 7.10.2
Resolution: | Keywords:
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 thomie):
Relevant commit 85926ae6c63a62e4f23423f220588875c8f1ab45:
{{{
Author: Iavor S. Diatchki

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * testcase: => testsuite/tests/th/TH_lookupName.hs * related: => #10583 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by albertus): * owner: => albertus * testcase: testsuite/tests/th/TH_lookupName.hs => testsuite/tests/th/TH_lookupName.hs, testsuite/tests/th/T11046.hs -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Phab:D1451 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * differential: => Phab:D1451 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Phab:D1451 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.0.1 => 8.2.1 Comment: This won't be fixed for 8.0. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Template Haskell | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Phab:D1451 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.2.1 => 8.4.1 Comment: It doesn't look like this will be fixed for 8.2 either. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with :
-------------------------------------+-------------------------------------
Reporter: oerjan | Owner: albertus
Type: bug | Status: new
Priority: high | Milestone: 8.4.1
Component: Template Haskell | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHC rejects | Test Case:
valid program | testsuite/tests/th/TH_lookupName.hs,
| testsuite/tests/th/T11046.hs
Blocked By: | Blocking:
Related Tickets: #10583 | Differential Rev(s): Phab:D1451
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: closed Priority: high | Milestone: 8.4.1 Component: Template Haskell | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Phab:D1451 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11046: lookupTypeName does not support type operators not starting with : -------------------------------------+------------------------------------- Reporter: oerjan | Owner: albertus Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Template Haskell | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | testsuite/tests/th/TH_lookupName.hs, | testsuite/tests/th/T11046.hs Blocked By: | Blocking: Related Tickets: #10583 | Differential Rev(s): Phab:D1451 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.4.1 => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11046#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC