
Hi, Mauricio, sorry for hijacking your thread. : ) I have one question about handling or parsing decimal places. I noticed that Haskell doesn't accept values starting with just the point, e.g., .50 or .01. I suppose that's abuse of notation in the first place (and I'm guilty of it), but I often receive datasets that have numbers written that way. Do we have this behavior to avoid ambiguity with the dot operator? For example:
.1 <interactive>:1:0: parse error on input `.'
read ".1" :: Float *** Exception: Prelude.read: no parse
And then:
let (.) = (+) 1 .1 2
I often end up writing a function that will add a leading zero when
it's missing for decimal places, before feeding a string to read. Is
there a better way of handling this?
Thanks,
Paulo
On Thu, Sep 18, 2008 at 7:13 AM, Mauricio
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 (...)
For some sense of "possible", the answer is clearly yes. However, it is perhaps misleading to call commas "THE international notation". (...) You might as well ask "is it possible to change Haskell syntax to support only the *real* Arabic digits ... for ... numbers". (... + evindences that there isn't one
single standard)
Well, utf-8 strings seemed to me a good way to initialize variables, and we could, for instance use something like "[1,2,3,4]" to initialize other kinds of lists besides the standard one. One example I got from gtk2hs are marked-up text on labels. So, I actually thought we could add support for arabic and japanese digits, and any other ways we get without ambiguities (continued fractions, I would like, and I also liked the idea of the raised dot).
Well, after all the comments, I'm convinced changing the Show and Read classes are not the way to go. But I'll think of something like a InitializableByUFT8String class, and I'll advertize it here if I ever get something usable and interesting.
Thanks for your comments, MaurĂcio
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe