Introduce unboxedSum{Data,Type}Name to template-haskell
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 18 Dec 2016 15:41:33 +0000 (10:41 -0500)
committerRyan Scott <ryan.gl.scott@gmail.com>
Sun, 18 Dec 2016 15:41:33 +0000 (10:41 -0500)
commitb5d788aa0e73fdf22cca3f88962e7652b07073cc
treed058f32e58bc561c350643f2f694cb547217f3c4
parent630cfc382084c48c8df84a2ac59c76710ae7e0e8
Introduce unboxedSum{Data,Type}Name to template-haskell

Summary:
In D2448 (which introduced Template Haskell support for unboxed
sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName`
functions, since there wasn't any way you could write unboxed sum data or type
constructors in prefix form to begin with (see #12514). But even if you can't
write these `Name`s directly in source code, it would still be nice to be able
to use these `Name`s in Template Haskell (for instance, to be able to treat
unboxed sum type constructors like any other type constructors).

Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in
`TysWiredIn`, which was calculating the arity of unboxed sum data constructors
incorrectly.

Test Plan: make test TEST=T12478_5

Reviewers: osa1, goldfire, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #12478, #12514
compiler/basicTypes/Lexeme.hs
compiler/prelude/TysWiredIn.hs
libraries/template-haskell/Language/Haskell/TH.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
testsuite/tests/th/T12478_5.hs [new file with mode: 0644]
testsuite/tests/th/all.T