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

Mauricio briqueabraque at yahoo.com
Wed Sep 17 10:24:39 EDT 2008


No, it is not. Strings created by show are
always supposed to be readable by read, no
matter which system used 'show' and which
system is using 'read'.

Maurício

Rafael C. de Almeida a écrit :
> Mauricio wrote:
>> Hi,
>>
>> A small annoyance some users outside
>> english speaking countries usually
>> experiment when learning programming
>> languages is that real numbers use
>> a '.' instead of ','. Of course, that
>> is not such a problem except for the
>> inconsistence between computer and
>> free hand notation.
>>
>> Do you think 'read' (actually,
>> 'readsPrec'?) could be made to also
>> read the international convention
>> (ie., read "1,5" would also work
>> besides read "1.5")? I'm happy to
>> finaly use a language where I can
>> use words of my language to name
>> variables, so I wonder if we could
>> also make that step.
>>
> 
> Isn't it locale dependent? If it isn't, it should be. Try setting your
> locale right and see if things work. At least awk work fine that way.
> 
> Although I don't like too much that kinda stuff, I usually set the
> locale to C so I keep all my programs behaving consistently. I have
> problems with that stuff before (a file generated by an awk script had ,
> instead of . and that would confuse other computers with a different
> locale).



More information about the Haskell-Cafe mailing list