GADTs in implementation of Template Haskell

Gershom B gershomb at gmail.com
Tue Oct 21 15:46:49 UTC 2014


On October 20, 2014 at 2:35:27 PM, Richard Eisenberg (eir at cis.upenn.edu) wrote:
> Having done so, I'm not 100% convinced that this is the right thing to do. I would love feedback  
> on my full, concrete proposal available at https://ghc.haskell.org/trac/ghc/wiki/Design/TemplateHaskellGADTs  
>  
> Is this a change for the better or worse? Feel free either to comment on the wiki page or  
> to this email.
>  
> Thanks!
> Richard

As I understand it, the big downsides are that we don’t get `gunfold` for Dec and Pragma, and we may not get `Generic` instances for them at all.

At first this felt pretty bad, but then I reviewed how generics and TH tend to get used together, and now I’m not _quite_ as anxious. In my mind the main use case for them is in things like this: http://www.well-typed.com/blog/2014/10/quasi-quoting-dsls/ — skimming the code involved, and the way `dataToExpQ` and friends tend to work, the key bit is having the generic instances on what we’re inducting on, not what we’re building… By the time we hit concrete TH syntax, it feels a bit late to be doing further generic transformations on it, so I have a suspicion this won’t hit anyone. I certainly don’t think it’ll affect _my_ uses of TH at least :-)

Cheers,
Gershom


More information about the Glasgow-haskell-users mailing list