[Haskell-cafe] Has character changed in GHC 6.8?
Magnus Therning
magnus at therning.org
Tue Jan 22 10:16:15 EST 2008
On 1/22/08, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
>
>
> On Tue, 2008-01-22 at 09:29 +0000, Magnus Therning wrote:
> > I vaguely remember that in GHC 6.6 code like this
> >
> > length $ map ord "a string"
> >
> > being able able to generate a different answer than
> >
> > length "a string"
>
> That seems unlikely.
Unlikely yes, yet I get the following in GHCi (ghc 6.6.1, the version
currently in Debian Sid):
> map ord "a"
[97]
> map ord "ö"
[195,182]
Funky, isn't it? ;-)
Easy!
>
> Prelude> 'å' == '\229'
> True
> Prelude> 'å' == Char.chr 229
> True
>
> Remember, when you type:
> Prelude> 'å'
>
> what you really get is:
> Prelude> putStrLn (show 'å')
>
> So perhaps what is confusing you is the Show instance for Char which
> converts Char -> String into a portable ascii representation.
Have you tried putting any of this into GHCi (6.6.1)? Any line with 'å'
results in the following for me:
> 'å'
<interactive>:1:2: lexical error in string/character literal at character
'\165'
> "å"
"\195\165"
Somewhat disappointing. GHCi 6.8.2 does perform better though.
/M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080122/6fdf12a2/attachment.htm
More information about the Haskell-Cafe
mailing list