[Haskell-cafe] Generic "to tuple" function
adam vogt
vogt.adam at gmail.com
Sat Dec 27 03:58:05 UTC 2014
On Fri, Dec 26, 2014 at 5:39 PM, Roman Cheplyaka <roma at ro-che.info> wrote:
> On 26/12/14 20:18, Michael Orlitzky wrote:
>> I could just do,
>>
>> from_tuple = uncurryN MLBBoxScoreGameBreakdownTeamXml
>> to_tuple = toTupleGeneric
>>
>> because things get real ugly when there are ~20 fields in the data type.
>
> Should be easy to do with the generics-sop package.
>
> Roman
http://lpaste.net/117317 works using the older Data.Data.Data, but
it's dissatisfying because if you get the result type wrong (too few
or too many elements), you'll always get a Nothing.
Maybe generics-sop is better in that respect.
Regards,
Adam
More information about the Haskell-Cafe
mailing list