Hi,<div><br></div><div>On 9 June 2011 16:15, Christopher Howard <span dir="ltr">&lt;<a href="mailto:christopher.howard@frigidcode.com">christopher.howard@frigidcode.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<div id=":nd">a &quot;trinary&quot; version of Either, i.e., allowing three values instead of two</div></blockquote><div><br></div><div>I&#39;d probably nest Eithers: <font class="Apple-style-span" face="&#39;courier new&#39;, monospace">Either a (Either b c)</font></div>
</div><div><br></div><div>You can also do some nicer trickery using the TypeOperators extension:</div><div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">{-# LANGUAGE TypeOperators #-}</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">type Or = Either</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">infixr 5 `Or`</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">k :: a `Or` b `Or` c -- Same as &quot;Either a (Either b c)&quot;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">k = undefined</font></div></div><div><br></div><div><div><br></div>HTH,<br>Ozgur<br>
</div>