Data.Generics vs. Template Haskell

Chris Kuklewicz haskell at list.mightyreason.com
Thu Aug 24 20:04:15 EDT 2006


Bulat Ziganshin wrote:
> Hello Vyacheslav,
> 
> Thursday, August 24, 2006, 11:51:46 PM, you wrote:
> 
>> I am trying to figure out where these two libraries stand in relation
>> to each other and which one is preferred to do generic programming in
>> Haskell. I understand that their goals often intersect but couldn't
>> find any good comparisons. Could someone point me in the right
>> direction?
> 

> summary: if your task fits into the features provided by g.p. tools,
> you will gain a much time using them. if your task need compile-time
> code generation (so that generic program will be no slower than
> hand-written one) or you need some advanced features which your g.p.
> tool doesn't provide - welcome to TH with all its programming
> oddities. development of TH routines for g.p. is an order of magnitude
> slower (at least!) than doing the same with specialized tool
> 
> 

TH and generics can be synergistic:  Generics reduce the amount of code you need 
to write to add new cases compared to more verbose techniques, and TH can 
automate writing some of the remaining boilerplate code.


More information about the Glasgow-haskell-users mailing list