Re: Associativity of the generic representation of sum types

2011-09-22 Thread Bas van Dijk
2011/9/22 José Pedro Magalhães j...@cs.uu.nl: Hi Bas, On Thu, Sep 22, 2011 at 03:55, Bas van Dijk v.dijk@gmail.com wrote: Hello, I just used the new GHC generics together with the DefaultSignatures extension to provide a default generic implementation for toJSON and parseJSON in the

Re: Associativity of the generic representation of sum types

2011-09-22 Thread Bas van Dijk
Hi José, I have another related question: (Excuse me for the big email, I had trouble making it smaller) I discovered a bug in my code that converts a product into a JSON value. I would like to convert products without field selectors into Arrays (type Array = Vector Value) and products with

Re: Associativity of the generic representation of sum types

2011-09-22 Thread Bas van Dijk
2011/9/22 Bas van Dijk v.dijk@gmail.com: What would make all this much easier is if the meta-information of constructors had a flag which indicated if it was a record or not. Could this be added? I just discovered the predicate: -- | Marks if this constructor is a record conIsRecord

Re: Associativity of the generic representation of sum types

2011-09-22 Thread Bas van Dijk
2011/9/22 Bas van Dijk v.dijk@gmail.com: I just discovered the predicate:  -- | Marks if this constructor is a record  conIsRecord :: t c (f :: * - *) a - Bool I think this can solve my problem. I think I have solved the bug now using conIsRecord. This is the new implementation:

Re: Associativity of the generic representation of sum types

2011-09-22 Thread Bas van Dijk
2011/9/22 Bas van Dijk v.dijk@gmail.com: I will make an official ticket for this. Done: http://hackage.haskell.org/trac/ghc/ticket/5499 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org