[Haskell-beginners] Haskell-style types in C or C++

Isaac Dupree ml at isaac.cedarswampstudios.org
Mon Aug 1 02:51:15 CEST 2011


On 07/31/11 15:58, Ertugrul Soeylemez wrote:
> Unions work, too, but they are not nearly as clean.  In general, avoid
> unions in C++, even though they seem to be a natural way to express
> ADTs.  They really are not.  Class hierarchies are the way to go.

Or boost::variant.  It's actual algebraic data types, at the expense of 
mighty weird syntax for pattern-matching because the Boost developers 
had to come up with something that compiled in C++.

~Isaac



More information about the Beginners mailing list