"Trinary" version of Either

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. -- frigidcode.com theologia.indicium.us

On Thu, Jun 9, 2011 at 10:15 AM, Christopher Howard
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

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.
Antoine Latter wrote:
What would the Monad operations do?
It appears that the equivalents of Either (Either a b) c and Either a (Either b c) could be equally useful. So perhaps both should be provided inside newtype wrappers. -Yitz

Hi,
On 9 June 2011 16:15, Christopher Howard
a "trinary" version of Either, i.e., allowing three values instead of two
I'd probably nest Eithers: Either a (Either b c) You can also do some nicer trickery using the TypeOperators extension: {-# LANGUAGE TypeOperators #-} type Or = Either infixr 5 `Or` k :: a `Or` b `Or` c -- Same as "Either a (Either b c)" k = undefined HTH, Ozgur
participants (4)
-
Antoine Latter
-
Christopher Howard
-
Ozgur Akgun
-
Yitzchak Gale