Text in Haskell: A PROPOSAL

Manuel M T Chakravarty chak@cse.unsw.edu.au
Thu, 08 Aug 2002 22:24:54 +1000 (EST)


ketil@ii.uib.no (Ketil Z. Malde) wrote,

> Ken Shan <ken@digitas.harvard.edu> writes:
> > I would be perfectly happy -- in fact, happier personally -- if Char
> > were to mean "Unicode code point" and a new type CChar were created
> > to mean "C char".
> 
> I think this is a more likely scenario.  I'd use Word8, and leave
> CChar for FFI purposes in case a "char" turns out to be different from
> eight bits.

I haven't followed this discussion in detail, but maybe the
purpose of the inclusion of CChar in the FFI is being
slightly misunderstood here.  All the Cxyz types from
CForeign are included to be able to write portable library
bindings for libraries coded in C (or at least compiled to
use C conventions).  In particular, the idea is that CChar
represents exactly what the corrsponding C compiler makes
"char" to be.

If you want an octet (without explicitly referring to some C
library functions), you are better off using Int8 or Word8.

Manuel