Make dataToQa aware of Data instances which use functions to implement toConstr
authorRyanGlScott <ryan.gl.scott@gmail.com>
Tue, 13 Oct 2015 05:43:32 +0000 (00:43 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 13 Oct 2015 05:43:42 +0000 (00:43 -0500)
commitd2f9972a35ce05ceb8a78893e433ef1df06f73ef
treebc3cee0ec99aacd64298993fde590c017734c6e6
parent94ef79a766a1f58a5daadcf7dbb342812cd1a9bd
Make dataToQa aware of Data instances which use functions to implement toConstr

Trac #10796 exposes a way to make `template-haskell`'s `dataToQa` function
freak out if using a `Data` instance that produces a `Constr` (by means of
`toConstr`) using a function name instead of a data constructor name. While
such `Data` instances are somewhat questionable, they are nevertheless present
in popular libraries (e.g., `containers`), so we can at least make `dataToQa`
aware of their existence.

In order to properly distinguish strings which represent variables (as opposed
to data constructors), it was necessary to move functionality from `Lexeme` (in
`ghc`) to `GHC.Lexeme` in a new `ghc-boot` library (which was previously named
`bin-package-db`).

Reviewed By: goldfire, thomie

Differential Revision: https://phabricator.haskell.org/D1313

GHC Trac Issues: #10796
24 files changed:
.gitignore
compiler/basicTypes/Lexeme.hs
compiler/ghc.cabal.in
compiler/main/PackageConfig.hs
docs/users_guide/7.12.1-notes.rst
ghc.mk
libraries/ghc-boot/GHC/Lexeme.hs [new file with mode: 0644]
libraries/ghc-boot/GHC/PackageDb.hs [moved from libraries/bin-package-db/GHC/PackageDb.hs with 100% similarity]
libraries/ghc-boot/LICENSE [moved from libraries/bin-package-db/LICENSE with 100% similarity]
libraries/ghc-boot/ghc-boot.cabal [moved from libraries/bin-package-db/bin-package-db.cabal with 61% similarity]
libraries/template-haskell/Language/Haskell/TH.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
libraries/template-haskell/changelog.md
libraries/template-haskell/template-haskell.cabal
rules/foreachLibrary.mk
testsuite/tests/codeGen/should_compile/jmp_tbl.hs
testsuite/tests/th/T10796a.hs [new file with mode: 0644]
testsuite/tests/th/T10796b.hs [new file with mode: 0644]
testsuite/tests/th/T10796b.stderr [new file with mode: 0644]
testsuite/tests/th/TH_Roles2.stderr
testsuite/tests/th/TH_nameSpace.hs [new file with mode: 0644]
testsuite/tests/th/TH_nameSpace.stdout [new file with mode: 0644]
testsuite/tests/th/all.T
utils/ghc-pkg/ghc-pkg.cabal