<div dir="ltr">On Thu, Apr 5, 2012 at 03:21, Holger Siegel <span dir="ltr">&lt;<a href="mailto:holgersiegel74@yahoo.de">holgersiegel74@yahoo.de</a>&gt;</span> wrote:<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Am 05.04.2012 um 08:42 schrieb Brandon Allbery:<div class="im">
&gt; On Thu, Apr 5, 2012 at 01:53, Sutherland, Julian &lt;<a href="mailto:julian.sutherland10@imperial.ac.uk">julian.sutherland10@imperial.ac.uk</a>&gt; wrote:<br>
&gt; data Tree = Node Left Right | Leaf<br>
&gt;<br>
&gt; Could be converted to a struct in C/C++:<br>
&gt;<br>
&gt; struct Tree {<br>
&gt;     struct Tree* left;<br>
&gt;     struct Tree* right;<br>
&gt; };<br>
&gt;<br>
&gt; Shouldn&#39;t this actually be a tagged union?  Not that they exist as such in C/C++, but are easy enough to emulate (minus the extra type checking that real tagged unions such as even Pascal gives you):<br>
<br>
</div>Not necessarily. The above type is equivalent to<br>
<br>
  type Tree = Maybe (Left, Right)<br></blockquote><div><br></div><div>But that is not the type being translated.  (Also, I would still consider translating Maybe as something other than a NULL pointer, just to enable sanity checking.)</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>