[Haskell-cafe] Re: Float instance of 'read'

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Sep 17 19:02:17 EDT 2008

On 18 Sep 2008, at 3:20 am, Mauricio wrote:
> Agree about the answer, not about the question. The
> correct one would be "is it possible to change haskell
> syntax to support the international notation (not any
> locally sensitive one) for decimal real numbers? Would
> a change in 'read' be a good first step?"

For some sense of "possible", the answer is clearly yes.
However, it is perhaps misleading to call commas
"THE international notation".  The plain fact of the
matter is that whatever any standards body may say,
there are MANY notations for numbers.  You might as
well ask "is it possible to change Haskell syntax to
support only the *real* Arabic digits ... for ...
numbers".  The Arabic script is used in many countries,
so it's international.  I don't read Arabic letters at
all, but to me numbers written in Arabic script are no
weirder than numbers using commas instead of dots.

I would draw readers' attention to
which says that
(1) China, India, and Japan use decimal points, not commas.
(2) There was a resolution of the CGPM in 2003
     "endorsing the use of the point on the line as a decimal sign".
(3) In June 2006, ISO agreed to allow the use of dots as decimal
     points in international standards.

As it happens, the decimal point character I greatly prefer is
the traditional British raised dot, but I can live with a low dot.

I am 100% behind internationalised input and output,
but allowing commas in numbers inside programming languages
that already use commas for other purposes is, let's be polite,
not a terribly good idea.  You could probably get away with it
in Lisp, but how many numbers are there in (1,2,3)?

One thing that definitely is missing from Haskell numbers, and
which I greatly miss, is a "thousands separator".  Ada got around
the dot/comma/apostrophe/whatever issue for thousands separators
by using the underscore.  For an unsigned decimal integer,
this means allowing [0-9](_?[0-9])* instead of [0-9]+.  It works
really well, despite not being ANYBODY's cultural convention.

> I know this looks difficult, but I'm sure it deserves at
> least some thinking. We have previous examples for
> less important issues: ghc does accept Windows end
> of line conventions, the minus and sign needs special
> syntax, and '.' can be used as decimal separator even
> if it's use as function notation.
> Best,
> Maurício
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> ====================================================================
>                    Auto Generated Mail  
> Footer                         If this email is requesting your  
> password then it is a HOAX.
>                    DO NOT reply to the email.
>                   Validate this footer at the
> Otago University web site keyword search: information security phish
> ====================================================================

If stupidity were a crime, who'd 'scape hanging?

More information about the Haskell-Cafe mailing list