[Haskell-cafe] Foldable for BNFC generated tree

Deniz Dogan deniz.a.m.dogan at gmail.com
Mon May 4 19:06:25 EDT 2009


2009/5/4 Martijn van Steenbergen <martijn at van.steenbergen.nl>:
> Hi Deniz,
>
> Deniz Dogan wrote:
>>
>> So, basically I'd like some sort of folding functionality for these
>> data types, without having to hack the lexer/parser myself
>> (parameterising the data types), because as I said they're being
>> generated by BNFC.
>
> What exactly do you mean by folding functionality? Folding as in the
> Foldable type class applies to containers, which your data type isn't.
> Perhaps you're looking for generic programming?
>
> There are several good GP libraries out there:
>
> * EMGM: http://www.cs.uu.nl/wiki/GenericProgramming/EMGM
> * Uniplate: http://community.haskell.org/~ndm/uniplate/
> * SYB: http://www.cs.vu.nl/boilerplate/
>
> See also Neil Mitchell's blog for some examples:
> http://neilmitchell.blogspot.com/2009/03/concise-generic-queries.html

You're right, what I was asking for didn't make much sense... I was
really looking for GP.

Thanks,
Deniz


More information about the Haskell-Cafe mailing list