[Haskell-cafe] Error handling package
nicolas.pouillard at gmail.com
Tue Oct 20 18:35:27 EDT 2009
On Wed, Oct 21, 2009 at 12:02 AM, Michael Snoyman <michael at snoyman.com> wrote:
> On Tue, Oct 20, 2009 at 5:17 PM, Nicolas Pouillard
> <nicolas.pouillard at gmail.com> wrote:
>> On Tue, Oct 20, 2009 at 3:12 PM, Michael Snoyman <michael at snoyman.com>
>> > On Tue, Oct 20, 2009 at 11:04 AM, Nicolas Pouillard
>> > <nicolas.pouillard at gmail.com> wrote:
>> >> On Sun, Oct 18, 2009 at 9:45 PM, Michael Snoyman <michael at snoyman.com>
>> >> wrote:
>> >> > While working on the next release of data-object, I wanted to
>> >> > represent
>> >> About the name Attempt, I think that 'Outcome' would be a better name.
>> > The problem with a name like "Outcome" is that it doesn't really imply
>> > the
>> > possibility of failure, simply that we are wrapping of the result for
>> > some
>> > reason.
>> I don't see why, the outcome of an action could be either a success or
>> a failure.
>> Even if the only *desired* outcome is success.
> I think I'm going to stick with Attempt. The only other point that came to
> me is it's nicer to have a function called "attempt" than "outcome" IMO.
>> fromAttempt :: (forall e. Exception e -> a) -> Attempt a -> a
>> fromAttempt f a = attempt f id a
> And of course I now realize this name will conflict with the FromAttempt
> typeclass ;). I think we'll be safe leaving this function out, considering
> how trivial it is to implement in terms of attempt.
BTW, fromAttempt instance can be nicely expressed using the 'attempt' function.
> Also, I've added a monad transformer to the github repo. I've tried it out
> in some local code I have, and it *really* cleans up the error handling.
Having the monad transformer too is great. The only minor disadvantage
is to make a choice between mtl and transformers. But transformers is
slowly replacing mtl so no big deal.
More information about the Haskell-Cafe