[Haskell-cafe] Contributing to http-conduit

Myles C. Maxfield myles.maxfield at gmail.com
Sat Jan 28 19:36:34 CET 2012

Ah, yes, you're completely right. I completely agree that moving the
function into the Maybe monad increases readability. This kind of function
is what the Maybe monad was designed for.

Here is a revised patch.

On Sat, Jan 28, 2012 at 8:28 AM, Michael Snoyman <michael at snoyman.com>wrote:

> On Sat, Jan 28, 2012 at 1:20 AM, Myles C. Maxfield
> <myles.maxfield at gmail.com> wrote:
> > the fromJust should never fail, beceause of the guard statement:
> >
> >     | 300 <= code && code < 400 && isJust l'' && isJust l' = Just $ req
> >
> > Because of the order of the && operators, it will only evaluate fromJust
> > after it makes sure that the argument isJust. That function in particular
> > shouldn't throw any exceptions - it should only return Nothing.
> >
> > Knowing that, I don't quite think I understand what your concern is. Can
> you
> > elaborate?
> You're right, but I had to squint really hard to prove to myself that
> you're right. That's the kind of code that could easily be broken in
> future updates by an unwitting maintainer (e.g., me). To protect the
> world from me, I'd prefer if the code didn't have the fromJust. This
> might be a good place to leverage the Monad instance of Maybe.
> Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120128/2a54a3b2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getRedirectedRequest.2.patch
Type: application/octet-stream
Size: 6355 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120128/2a54a3b2/attachment.obj>

More information about the Haskell-Cafe mailing list