<div dir="ltr">My aim is to extend the capabilities of ghc-mod to do case split. For that matter, I'm using the GHC module of the ghc package (the same ghc-mod uses). Via the exprType function I get a Type value. Then, I would like to be able to call getInfo (everything from the GHC module) to get the information of that type.<div>

<br></div><div>I'm not sure if using Template Haskell is something I can use, but I will definitely try :)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-04 0:01 GMT+02:00 Nils Schweinsberg <span dir="ltr"><<a href="mailto:mail@nils.cc" target="_blank">mail@nils.cc</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm not sure what exactly you're trying to do, but with Template Haskell it's easy:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
test :: Name -> Q [Dec]<br>
test name = do<br>
  info <- reify name<br>
  ...<br>
</blockquote>
<br>
Then call it from another module with the type name as argument (double single quotes):<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
data Test = A | B<br>
<br>
test ''Test<br>
</blockquote>
<br>
The `Info` type returned by `reify` is described in:<br>
<br>
<a href="http://hackage.haskell.org/package/template-haskell-2.9.0.0/docs/Language-Haskell-TH-Syntax.html#t:Info" target="_blank">http://hackage.haskell.org/<u></u>package/template-haskell-2.9.<u></u>0.0/docs/Language-Haskell-TH-<u></u>Syntax.html#t:Info</a><br>


<br>
<br>
- Nils<br>
<br>
Am 03.06.2014 21:13, schrieb Alejandro Serrano Mena:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Dear Haskell-Café,<br>
As part of my Google Summer of Code, I need to get the list of data<br>
constructors of a certain data type on a specific scenario.<br>
In my case, I'm getting a value of type Type (by calling exprType). I<br>
was expecting to be able to call getInfo directly on that value of type<br>
Type, but it doesn't have a name nor the constructors of Type are<br>
public. Thus, I'm not able to get that information :(<br>
<br>
Thanks in advance,<br>
Alejandro<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
<br>
</blockquote>
</blockquote></div><br></div>