[GHC] #9527: Add Generic instances for Language.Haskell.TH
GHC
ghc-devs at haskell.org
Sat Oct 18 19:46:58 UTC 2014
#9527: Add Generic instances for Language.Haskell.TH
-------------------------------------+-------------------------------------
Reporter: nh2 | Owner: goldfire
Type: feature | Status: new
request | Milestone: 7.10.1
Priority: normal | Version: 7.8.3
Component: Core | Keywords:
Libraries | Architecture: Unknown/Multiple
Resolution: | Difficulty: Moderate (less
Operating System: | than a day)
Unknown/Multiple | Blocked By: 9526
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by luite):
While you're at it, could you check if adding `Binary` instances is still
problematic? The binary package is not a dependency at the moment. There's
a comment in the code about switching to `Binary` (from `Data`) for
serialization for annotations:
http://git.haskell.org/packages/template-
haskell.git/blob/9bcc122819a6f4a2ae7ad569717324b8368e801c:/Language/Haskell/TH/Syntax.hs#l661
Serialization of the other data types is useful for out-of-process TH
currently used by GHCJS, possibly in the future for cross compilation
(someone started porting the GHCJS code to GHC but appears to have stopped
working on it, I hope i have time to pick this up soon)
Using the default `Binary` instance based on the `GHC.Generics` is ok for
this purpose and works for almost all types. Here is my list of orphan
instances:
https://github.com/ghcjs/ghcjs-
prim/blob/915f263c06b7f4a246c6e02ecdf2b9a0550ed967/GHCJS/Prim/TH/Types.hs#L113-L166
`NameFlavour` requires a handwritten instance because of an `Int#` field.
Can this be changed to a strict `Int` field?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9527#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list