[Haskell-cafe] Reify type
Michael Sloan
mgsloan at gmail.com
Fri Jul 12 14:07:24 CEST 2013
Hello!
I'm not sure if this is what you're asking for, as it doesn't fit that line
of code. 'LitT' is a data constructor not a type constructor. So instead
it'd be
reifyType (LitT ...) = ConE 'LitT ...
If this is what you're looking for, then 'lift' is what you want:
http://hackage.haskell.org/packages/archive/th-lift/latest/doc/html/Language-Haskell-TH-Lift.html<http://hackage.haskell.org/packages/archive/th-lift/0.5.5/doc/html/Language-Haskell-TH-Lift.html>
In particular, I recommend using this package of template haskell orphans,
rather than deriving your own: http://hackage.haskell.org/package/th-orphans
Hope that helps!
-Michael
On Fri, Jul 12, 2013 at 4:45 AM, Jose A. Lopes <jabolopes at google.com> wrote:
> Hello everyone,
>
> Is there a way to automatically reify a type ?
> In other words, to do the following:
>
> reifyType (LitT ...) = ConT ''LitT ...
>
> I am using Template Haskell and I want the generated code to have
> access to Type datatypes that were available to the Template Haskell
> code.
>
> Cheers,
> Jose
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130712/ed11196b/attachment.htm>
More information about the Haskell-Cafe
mailing list