Re: [Haskell-beginners] "Trinary" version of Either

On Thu, Jun 9, 2011 at 3:58 PM, Christopher Howard
My preference would be: just like a regular Monad either instance from mtl, except that the Middle value also bypasses the bound function. My semantics would be: left value represents error, right reprents normal results, and middle represents results that are not erroneous but that prevent further calculations. I have some idea of how this could be used to chain together actions and avoid messy branching in code.
From your description, 'Either (Either errType earlyExitType) a' should do everything you want, then, with the default monad instance for either.
You would need something like:
myThrowError = Left . Left haltExecution = Left . Right
Antoine
Sent from my HTC
----- Reply message ----- From: "Antoine Latter"
Date: Thu, Jun 9, 2011 8:18 am Subject: [Haskell-beginners] "Trinary" version of Either To: "Christopher Howard" Cc: "Haskell Beginners" On Thu, Jun 9, 2011 at 10:15 AM, Christopher Howard
wrote: Is there a Haskell package out there that provides a "trinary" version of Either, i.e., allowing three values instead of two? I can see how that would be very handy. Defining one obviously wouldn't be difficult, but it would be helpful if someone else had already developed Monad bindings and other related stuff.
What would the Monad operations do?
-- frigidcode.com theologia.indicium.us
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (1)
-
Antoine Latter