
26 Dec
2014
26 Dec
'14
6:18 p.m.
I have tons of code like this: from_tuple = uncurry MLBBoxScoreGameBreakdownXml to_tuple (MLBBoxScoreGameBreakdownXml a h) = (a,h) The first function, from_tuple, generalizes easily with `uncurryN` from Data.Tuple.Curry. But I'm wondering, is there any generic function that will take a simple data type and cram it into a tuple? So instead of writing, from_tuple = uncurryN MLBBoxScoreGameBreakdownTeamXml to_tuple (MLBBoxScoreGameBreakdownTeamXml w x y z) = (w,x,y,z) 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.