[Haskell-beginners] Showing a value, when there are many approaches?

Chris Schneider chris at christopher-schneider.com
Wed Aug 7 21:47:55 CEST 2013


Ok, that makes sense, I misinterpreted `show` since for integers & friends
it is just the same as a `toString` in other languages.

Is there a standard name for "render a human readable form of this data"?
 toString() in java, to_s in ruby, and similar?




On Wed, Aug 7, 2013 at 12:51 PM, Brandon Allbery <allbery.b at gmail.com>wrote:

> On Wed, Aug 7, 2013 at 1:04 PM, Chris Schneider <
> chris at christopher-schneider.com> wrote:
>
>> I can't just use a `show` function directly to do this, since there are
>> options I need to pass.
>>
>
> And you shouldn't use `show` for this, because if it prints your
> MacAddress as anything other than an unambiguous representation of the
> Haskell MacAddress type then it has lost information useful for debugging.
> More to the point: if I cannot see the difference between your MacAddress
> and a String, then it's an unacceptable `show`. `show` should reflect the
> Haskell data structure so I can verify that my program is doing the right
> thing; if it shows what looks like a String, but I'm expecting to see a
> MacAddress, then I will suspect a type error somewhere.
>
> `show` is like Perl's Data::Dumper or Python's repr. I don't want pretty,
> I want accuracy.
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130807/e11fb3e0/attachment.htm>


More information about the Beginners mailing list