<div dir="ltr">On Thu, Apr 5, 2012 at 03:21, Holger Siegel <span dir="ltr"><<a href="mailto:holgersiegel74@yahoo.de">holgersiegel74@yahoo.de</a>></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">
> On Thu, Apr 5, 2012 at 01:53, Sutherland, Julian <<a href="mailto:julian.sutherland10@imperial.ac.uk">julian.sutherland10@imperial.ac.uk</a>> wrote:<br>
> data Tree = Node Left Right | Leaf<br>
><br>
> Could be converted to a struct in C/C++:<br>
><br>
> struct Tree {<br>
> struct Tree* left;<br>
> struct Tree* right;<br>
> };<br>
><br>
> Shouldn'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>