Proposal: Deprecate decodeUtf8

Carter Schonwald carter.schonwald at gmail.com
Fri Aug 19 22:40:45 UTC 2016


Why not propose adding a variant that exposes the error handling.
Deprecation is a heavy hammer when most users seem to know that it's
partial or discover it rather quickly.

On Thursday, August 18, 2016, Niklas Hambüchen <mail at nh2.me> wrote:

> My idea was to use DEPRECATED to indicate that it comes from a time
> where partial functions were considered OK, but this is no longer common
> practice now.
>
> WARNING would work just as well though, I'd have no preference between
> the two.
>
> On 18/08/16 23:13, evan at evan-borden.com <javascript:;> wrote:
> > If the intent is to keep this function indefinitely then why abuse
> > DEPRECATED? Why not utilize WARNING?
> >
> > On Thu, Aug 18, 2016 at 7:50 AM, Oleg Grenrus <oleg.grenrus at iki.fi
> <javascript:;>
> > <mailto:oleg.grenrus at iki.fi <javascript:;>>> wrote:
> >
> >     So (as also pointed by Edward):
> >
> >     - Some people are aware that decodeUtf8 is partial and rely on that
> >     behaviour
> >     - Some people aren’t aware, and think that decodeUtf8 is like
> >     `decodeUtf8With lenientDecode` or `decodeUtf8With ignore`.
> >
> >     Then if we add a {-# DEPRECATED #-} warning on `decodeUtf8`, we
> >     should add variants for both use cases
> >
> >     lenientDecodeUtf8 which is total, and
> >     unsafeDecodeUtf8 or strictDecodeUtf8, which is what decodeUtf8 does
> >     today.
> >
> >     I’d like the new names, for convenience, `OnDecodeError` values
> >     would require a new module import.
> >
> >     - Oleg
> >
> >
> >     > On 18 Aug 2016, at 14:40, Niklas Hambüchen <mail at nh2.me
> <javascript:;>
> >     <mailto:mail at nh2.me <javascript:;>>> wrote:
> >     >
> >     > On 18/08/16 18:11, Oleg Grenrus wrote:
> >     >> Or should it be changed
> >     >>
> >     >> - decodeUtf8 = decodeUtf8With strictDecode
> >     >> + decodeUtf8 = decodeUtf8With lenientDecode
> >     >
> >     > I'd be very upset for that kind of a semantics change to sneak in
> >     under me.
> >     >
> >
> >
> >     _______________________________________________
> >     Libraries mailing list
> >     Libraries at haskell.org <javascript:;> <mailto:Libraries at haskell.org
> <javascript:;>>
> >     http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >     <http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries>
> >
> >
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org <javascript:;>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160819/5931bccd/attachment.html>


More information about the Libraries mailing list