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

Brandon Allbery allbery.b at gmail.com
Wed Aug 7 20:51:15 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130807/70bbf78a/attachment.htm>


More information about the Beginners mailing list