I guess that is a good point, but due to backwards compatibility this is propably not acceptable:
These libraries are fairly new so it's easy to change them. (AFAIK, only GHC has released a compiler with these libraries and they only appeared in the 5.04 release.) If a change is appropriate, please tell us. I, personally, haven't given much thought to UTF8 encoding but people on the ffi mailing list (ffi@haskell.org) have, so send us a brief explanation of what change is needed and why.
The C interface of the FFI has the string functions:
peekCString :: CString -> IO String newCString :: String -> IO CString
which should really be
peekCString :: CString -> IO [Word8] newCString :: [Word8] -> IO CString
Unless that changes, there is really no point to give the encode and decode functions that type.
One of the great things about the FFI is that it is really easy to use. In particular, it's easy to write your own functions which do the right thing so if lack of functions with the right type is holding you back, it's easy to add the right functions yourself. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/