[Haskell-cafe] Haskell integration with C/C++ (GSOC)
Brandon Allbery
allbery.b at gmail.com
Thu Apr 5 09:59:00 CEST 2012
On Thu, Apr 5, 2012 at 03:21, Holger Siegel <holgersiegel74 at yahoo.de> wrote:
> Am 05.04.2012 um 08:42 schrieb Brandon Allbery:
> > On Thu, Apr 5, 2012 at 01:53, Sutherland, Julian <
> julian.sutherland10 at imperial.ac.uk> wrote:
> > data Tree = Node Left Right | Leaf
> >
> > Could be converted to a struct in C/C++:
> >
> > struct Tree {
> > struct Tree* left;
> > struct Tree* right;
> > };
> >
> > 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):
>
> Not necessarily. The above type is equivalent to
>
> type Tree = Maybe (Left, Right)
>
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.)
--
brandon s allbery allbery.b at gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120405/6cadb9ab/attachment.htm>
More information about the Haskell-Cafe
mailing list