String != [Char]

Johan Tibell johan.tibell at
Mon Mar 19 17:59:42 CET 2012

On Mon, Mar 19, 2012 at 9:02 AM, Christian Siefkes
<christian at> wrote:
> On 03/19/2012 04:53 PM, Johan Tibell wrote:
>> I've been thinking about this question as well. How about
>> class IsString s where
>>     unpackCString :: Ptr Word8 -> CSize -> s
> What's the Ptr Word8 supposed to contain? A UTF-8 encoded string?


We could make a distinction between byte and Unicode literals and have:

class IsBytes a where
    unpackBytes :: Ptr Word8 -> Int -> a

class IsText a where
    unpackText :: Ptr Word8 -> Int -> a

In the latter the caller guarantees that the passed in pointer points
to wellformed UTF-8 data.

-- Johan

More information about the Haskell-prime mailing list