[Haskell-cafe] Optimising UTF8-CString -> String marshaling, plus comments on withCStringLen/peekCStringLen

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Jun 4 06:33:38 EDT 2007


Hello Duncan,

Monday, June 4, 2007, 2:25:10 PM, you wrote:

>>  - the chr function tests that its Int argument is less than 1114111,
>>    before constructing the Char. It'd be nice to avoid this test.

use unsafeChr or, for portability, smth like this:

#ifdef GHC
import GHC.Exts (unsafeChr)
#else
unsafeChr = chr
#endif


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list