If the input is specified to be UTF-8, wouldn't it be better to call the method unpackUTF8 or something like that?
On Mon, Mar 19, 2012 at 9:02 AM, Christian SiefkesYes.
<christian@siefkes.net> 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
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime