String != [Char]

Daniel Peebles pumpkingod at gmail.com
Mon Mar 19 22:55:47 CET 2012


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 12:59 PM, Johan Tibell <johan.tibell at gmail.com>wrote:

> On Mon, Mar 19, 2012 at 9:02 AM, Christian Siefkes
> <christian at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-prime/attachments/20120319/15d2a759/attachment.htm>


More information about the Haskell-prime mailing list