[Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0
qdunkan at gmail.com
Wed Oct 19 19:20:52 CEST 2011
On Wed, Oct 19, 2011 at 9:49 AM, Stephen Tetley
<stephen.tetley at gmail.com> wrote:
> On 19 October 2011 15:59, AM <agentm at 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.
More information about the Haskell-Cafe