[GHC] #13968: TH gives "Illegal binding of built-in syntax" error

#13968: TH gives "Illegal binding of built-in syntax" error -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | 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: -------------------------------------+------------------------------------- If you try to splice in a definition that borrows an already existing `Name` using Template Haskell, GHC gives a confusing error message: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module Bug where import Language.Haskell.TH $(pure [ValD (VarP 'succ) (NormalB (ConE 'True)) []]) }}} {{{ $ /opt/ghc/8.2.1/bin/runghc Bug.hs Bug.hs:6:3: error: Illegal binding of built-in syntax: succ | 6 | $(pure [ValD (VarP 'succ) (NormalB (ConE 'True)) []]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} I'm not exactly sure what should happen here. My hunch was that my spliced-in `succ` would shadow the `succ` that's already in-scope. But in any case, the error message you get currently is quite awful, so at the very least that should be improved. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13968 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13968: TH gives "Illegal binding of built-in syntax" error -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 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): Phab:D3789 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3789 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13968#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13968: TH gives "Illegal binding of built-in syntax" error
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Template Haskell | Version: 8.0.1
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): Phab:D3789
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#13968: TH gives "Illegal binding of built-in syntax" error -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: th/T13968 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3789 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => th/T13968 * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13968#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC