[Haskell-cafe] Poor man's generic programming

Henning Thielemann schlepptop at henning-thielemann.de
Mon Jan 18 19:38:11 EST 2010


Neil Mitchell schrieb:
> Hi Henning,
>
> Uniplate might be the answer you are looking for -
> http://community.haskell.org/~ndm/uniplate
>   
Thanks for the pointer!
> Uniplate is simple (only multi parameter type classes, and even then
> only in a very simple usage), fast (one of the fastest generics
> libraries) and concise (probably the most concise generics library).
> It's also not as powerful as most of the other generics libraries, but
> I find it does about 98% of the generics tasks I need. Uniplate is
> used extensively in virtually all my tools, for example HLint.
>   
Must a package import Uniplate, if it uses Uniplate generics, or is it a 
preprocessor like I sketched?
> As an example, I guess your function returns all the Int's embedded
> within a data type, at any level?
I abstracted the Bin example from GHC's generic extension introduction:
   
http://www.haskell.org/ghc/docs/latest/html/users_guide/generic-classes.html



More information about the Haskell-Cafe mailing list