On Wed, Oct 19, 2011 at 9:49 AM, Stephen Tetley
<stephen.tet...@gmail.com> wrote:
> On 19 October 2011 15:59, AM <age...@themactionfaction.com> wrote:
>
>> Note that other programming languages have had to solve this exact problem 
>> and they usually end up with multiple functions- one for debugging, one for 
>> serialization, one for displaying how the object was constructed.
>>
>
> As per Haskell with Show (representation) and Data.Binary
> (serialization), of course.

That's different, python's str() is meant to be human readable and not
necessarily parseable, I have a haskell equivalent in a Pretty class.
repr() is like haskell's show, it's meant to also be human readable
but also be parseable to get the original value back.

The problem is that you can write deriving for Show but not for
Pretty, so as soon as you want to pretty a record you're back to
writing stuff by hand, even if it's just to fix up one field (say it's
a function or a huge table that you want to abbreviate to 'HugeTable:
73246 entries').  Perhaps the new generic deriving stuff could fix
that, I'd like to see 'deriving (Show)' implemented in haskell so I
could write my own variations.

Data.Binary would be what python calls pickle.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to