[Haskell-beginners] Re: number formatting with locale
Heinrich Apfelmus
apfelmus at quantentunnel.de
Tue Sep 8 04:42:19 EDT 2009
Dmitry Simonchik wrote:
> I'm trying to print out Double in russian locale (we use "," as decimal
> separator insetad of "."). I'm trying to set locale with
> System.Locale.SetLocale like
>
> setLocale LC_ALL $ Just "ru_RU.UTF-8"
>
> this returns Just "ru_RU.UTF-8", so it seems that function call succeeded,
> but when I call
>
> show 20.2
>
> it just prints 20.2 and not desired 20,2
>
> Can anyone please help?
By design, show and read don't use the locale. Not to mention that
since Haskell is pure, it is *impossible* for the expression show 20.2
:: String to depend on the current locale.
I have never tried to use locales in Haskell, maybe someone else can
help. Most likely, you'll need to do foreign imports of C functions.
Regards,
apfelmus
--
http://apfelmus.nfshost.com
More information about the Beginners
mailing list