[Hs-Generics] EMGM: deriving instances

Antoine Latter aslatter at gmail.com
Thu Feb 19 12:02:38 EST 2009


On Thu, Feb 19, 2009 at 2:26 AM, Sean Leather <leather at cs.uu.nl> wrote:
>
> So, from what you say, your problem is with String and Bool?
>
> If you want immediate satisfaction and you're only using functions based on
> Rep (i.e. not FRep, FRep2, etc.), then you can change your deriving code to
> this:
>
>> import Generics.EMGM.Common.Derive
>
>> $(declareConDescrs ''A)
>> $(declareEP ''A)
>> $(deriveRep ''A)
>
>> $(declareConDescrs ''B)
>> $(declareEP ''B)
>> $(deriveRep ''B)
>
>> $(declareConDescrs ''MyData)
>> $(declareEP ''MyData)
>> $(deriveRep ''MyData)
>
> "deriveRep" doesn't care whether a type is primitive or not. It does the
> same thing for every type, notably use the "rep" method as type
> representation.
>
> Otherwise, you'll have to wait on a fix. ;)
>

Sadly I was hoping to use the EMGM 'map' function on a more complex
type.  From what I can tell that uses the FRep instances, correct?

Thanks for the quick response.

Antoine


More information about the Generics mailing list