News for hackers. Stuff that matters.
Re:Haskell in Production: The good, the bad, and the ugly by irahul on Thursday November 01, 2012 @12:58AM (#4726266)
> Maybe is a monad, which means Maybe computations can be chained together with `>>=` (or using `do` notation) without checking for `Nothing`. You can easily produce a large composition of potentially-failing computations while completely ignoring the possibility of failure.

Like

     val = foo.bar.blah.boo rescue nil
Or

    try {
        val = foo.bar().blah().boo()
    } catch(NullPointerException ex) {
    }
Or

    try:
        val = foo.bar().blah().boo()
    except AttributeError:
        pass
Yes, I know Maybe is a monad, but that doesn't make a difference to me. A series of computation where a step depends on the results of the previous step and the previous step can return null is hardly an issue in any language.

> The case analysis you give as an example is only required at the point when you want to extract the final result into a different monadic context, and even then you would typically use the `maybe` or `fromMaybe` functions to make it more concise.

The case analysis I give is an example where either there is a value or null and I need the value. I don't really care how Haskell defines monadic context.

There are no comments on this comment yet.