[GHC] #13968: TH gives "Illegal binding of built-in syntax" error
GHC
ghc-devs at haskell.org
Wed Jul 12 21:57:18 UTC 2017
#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
More information about the ghc-tickets
mailing list