Parameterized type gives Template Haskell error
Closed this issue · 3 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Create a datatype with a parameter; the RHS can apparently be anything (the
parameter needn't even be used at all)
2. Attempt to $(derive [''YourParameterizedType])
What is the expected output? What do you see instead?
Compilation fails with a message such as:
UnboundTest.hs:9:1:
The exact Name ‘a_a1gU’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
What version of the product are you using? On what operating system?
RepLib 0.5.3.3; tried on both GHC 7.6.3 and GHC 7.8.3.
Please provide any additional information below.
See attached test case.
Original issue reported on code.google.com by jyr...@gmail.com
on 12 Oct 2014 at 11:50
Attachments:
GoogleCodeExporter commented
Deriving with Template Haskell requires a few language extensions for the
generated code. Changing the language pragma in UnboundTest.hs to read
{-# LANGUAGE TemplateHaskell,
ScopedTypeVariables, FlexibleInstances,MultiParamTypeClasses,
FlexibleContexts #-}
should do the trick.
Original comment by stephanie.weirich
on 14 Oct 2014 at 1:48
- Changed state: WontFix
GoogleCodeExporter commented
!! I *thought* I'd gotten it to work before :-\ Pardon the spam. (I don't
suppose it's possible to generate the code so it fails more helpfully in this
case?)
Original comment by jyr...@gmail.com
on 14 Oct 2014 at 3:18
GoogleCodeExporter commented
I don't think it is possible. It would useful if TH could generate the
appropriate LANGUAGE pragmas, but that also seems a bit strange too.
Alternatively, there's a recent reimplementation of unbound using GHC.Generics
instead of RepLib. In that case, no TH is required.
https://github.com/lambdageek/unbound-generics
Original comment by stephanie.weirich
on 14 Oct 2014 at 11:48