Proposal: Deprecate decodeUtf8

Edward Kmett ekmett at gmail.com
Thu Aug 18 11:26:03 UTC 2016


Changing the combinator's semantics seems likely to be worse to me. I have
actual code using that function that would become much more dangerous if it
started accepting data through it that it can't round trip. Right now that
partiality acts as a dumb but effective safety net.

I'm neutral on the basic proposal, however.

-Edward

On Thu, Aug 18, 2016 at 6:11 AM, Oleg Grenrus <oleg.grenrus at iki.fi> wrote:

> Or should it be changed
>
> - decodeUtf8 = decodeUtf8With strictDecode
> + decodeUtf8 = decodeUtf8With lenientDecode
>
> > On 18 Aug 2016, at 12:08, Niklas Hamb├╝chen <mail at nh2.me> wrote:
> >
> > I propose to add a deprecation pragma to the partial function
> > Data.Text.decodeUtf8.
> >
> > I see checks or decoding failure accidentally omitted from production
> > code every week. I claim decodeUtf8 to be *the* most abused partial
> > function in the current Haskell ecosystem (with `head` and `tail` at
> > least everybody knows they should feel bad when typing them down).
> >
> > decodeUtf8' with custom error message is a better solution in all cases
> > I have seen and can come up with.
> >
> > I therefore propose:
> >
> >  * Add deprecation pragma to decodeUtf8
> >  * Do it with Text.Lazy and *16/*32 functions too
> >  * But keep them indefinitely (we don't want to break compiles)
> >
> > I believe that deprecating decodeUtf8 will result in lots of useful
> > warnings across the world every day and less software crashing at
> runtime.
> >
> > Discussion period 2 months.
> >
> > Thanks!
> > _______________________________________________
> > Libraries mailing list
> > Libraries at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160818/cf55e39f/attachment.html>


More information about the Libraries mailing list