Skip to content

Bogus multiple-declaration error in GHCi + Template Haskell

Try this (with ghc 7.8.3)

th% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
th $ ghc --interactive -XTemplateHaskell
GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> let x = True
Prelude> let y = [d| x = 'c' |]

<interactive>:3:13:
    Multiple declarations of ‘x’
    Declared at: <interactive>:2:5
                 <interactive>:3:13
    In the Template Haskell quotation [d| x = 'c' |]

This is obviously wrong, a failure of the name-shadwing code in RnNames.extendGlobalRdrEnvRn.

I suspect that this afflicts 7.10 too, but I can't check that right now.

Working on a fix.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information