<div dir="ltr"><font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif">Thanks for the references.  Glad to see this isn&#39;t an unreasonable wish.<br clear="all"></font></font></font><div dir="ltr"><font><font face="&#39;trebuchet ms&#39;, sans-serif"><i><font color="#003333"><br>

-- Russ </font></i></font></font></div><br>
<br><br><div class="gmail_quote">On Tue, Dec 14, 2010 at 2:15 PM, Ozgur Akgun <span dir="ltr">&lt;<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

This reminds me of an old thread started by, well me :)<div><br></div><div><a href="http://www.haskell.org/pipermail/haskell-cafe/2010-March/074805.html" target="_blank">http://www.haskell.org/pipermail/haskell-cafe/2010-March/074805.html</a> (sorry for the typos)</div>


<div><br></div><div>It is not an especially enlightening thread, but contains some nice references.</div><div><br></div><div>HTH,</div><div><br></div><div><div><div></div><div class="h5"><div class="gmail_quote">On 14 December 2010 20:09, Russ Abbott <span dir="ltr">&lt;<a href="mailto:russ.abbott@gmail.com" target="_blank">russ.abbott@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif">Is there a way to get this to work?</font></font></font><div>


<font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif"><br>

</font></font></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)">

data A = Aconstructor Int</div></font></font></div><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)">data B = Bconstructor Int</div></font></font></div><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)">




data AorB = A | B</div></font></font></div><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)"><br></div></font></font></div><div><font size="2"><font face="trebuchet ms,sans-serif"><div>




<div><font color="#003333">f :: Int -&gt; AorB</font></div><div><font color="#003333"><div>f x </div><div>  | even x     = Aconstructor x </div><div>  | otherwise = Bconstructor x </div>

<div><br></div></font></div></div></font></font></div></blockquote><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)"> I get this diagnostic.</div><div style="color:rgb(0, 51, 51)">




<br></div></font></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font size="2"><font face="trebuchet ms,sans-serif"><div><div><font color="#FF0000">Couldn&#39;t match expected type `AorB&#39; against inferred type `A&#39; </font></div>




</div></font></font></div></blockquote><div><font size="2"><font face="trebuchet ms,sans-serif"><div style="color:rgb(0, 51, 51)"><br></div><div style="color:rgb(0, 51, 51)">Since AorB is A or B, why is this not permitted?</div>




<div style="color:rgb(0, 51, 51)"><br></div><div style="color:rgb(0, 51, 51)">If instead I write </div><div style="color:rgb(0, 51, 51)"><br></div></font></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">




<div><font size="2"><font face="trebuchet ms,sans-serif"><div><font color="#003333">data AorB = Aconstructor Int | Bconstructor Int </font></div></font></font></div></blockquote><div><font size="2"><font face="trebuchet ms,sans-serif"><div>




<font color="#003333"><br></font></div><div><font color="#003333">everything works out ok. But what if I want separate types for A and B?</font></div><div><br></div><div style="color:rgb(0, 51, 51)">

Thanks,</div></font></font><div dir="ltr"><font><font face="&#39;trebuchet ms&#39;, sans-serif"><i><font color="#003333"><br><font color="#888888">-- Russ </font></font></i></font></font></div>
</div></div>
<br></blockquote></div><br></div></div>-- <br>Ozgur Akgun<br>
</div>
</blockquote></div><br></div>