I'm very strongly against this proposal.  .Char8 provides a lot of
functionality that's exactly what I want.  I think any library that
causes compile errors when used with .Char8 is being a very bad
citizen.  In fact, if I came across a random library doing that, it
would look to me like it was a purely spiteful decision, and I'd avoid
the library specifically because of it.

Basically, I think it inappropriate to be a bad citizen in that
manner.  I have to very strongly advocate doing something else
instead.

Carl

On Fri, Jul 16, 2010 at 8:42 AM, Shane <[email protected]> wrote:
> Hi,
>
> Data.ByteString.Char8 is used a lot in Snap. I think this is primarily
> because it provides an IsString instance for ByteString and some crude
> functions for converting between String and ByteString. Those functions
> are bad though because they're lossy, they will only work as expected if
> the strings they're working on use only plain ASCII, which is ridiculous
> in this day and age.
>
> In any commits I've made recently, I've not used Data.ByteString.Char8
> but Data.ByteString.UTF8. Basically, I don't enjoy typing U.fromString
> all the time and I really wish it was simply toBS instead. Also, I can
> either chose between not using OverloadedStrings at all, or using it but
> verifying that any String literals I use do not contain Unicode
> characters.
>
> What I think would be a great way to make this situation better would be
> for Snap.Types to export functions toBS and fromBS which use
> Data.ByteString.UTF8. They're much shorter (and clearer) to type than
> U.fromString, and as a user you don't have to add an extra dependency of
> utf8-string to your .cabal file to use them. Maybe even export showBS
> and readBS too. I think this would discourage people from using Char8.
>
> What is perhaps more controversial is that I think we should never, ever
> use Char8 at all, because its instance for IsString is evil (by breaking
> Unicode), and instead we should export an (orphan) IsString instance
> from Snap.Types for ByteString which uses Data.ByteString.UTF8 instead.
>
> This would mean that nothing that uses Snap.Types could ever use
> Data.ByteString.Char8 too, or at least there would be duplicate
> instances for IsString ByteString. I kind of think that would be a good
> thing though.
>
> What do people think?
>
> Shane.
>
> _______________________________________________
> Snap mailing list
> [email protected]
> http://mailman-mail5.webfaction.com/listinfo/snap
>
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to