[Haskell-beginners] "Trinary" version of Either

Ozgur Akgun ozgurakgun at gmail.com
Thu Jun 9 18:34:15 CEST 2011


On 9 June 2011 16:15, Christopher Howard <christopher.howard at frigidcode.com>

> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110609/02ec7dd8/attachment.htm>

More information about the Beginners mailing list