On Mon, Mar 19, 2012 at 9:02 AM, Christian Siefkes <christ...@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?
Yes. 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