
You should look into the Union datatype. It has been a long while since I coded in C but I believe it allowed you to define a struct-like datatype which could contain exactly 1 value from a list of datatypes. I found a forum post about it: http://www.go4expert.com/forums/showthread.php?t=15 Hope that helps. On Sat, Jul 30, 2011 at 11:45 AM, Christopher Howard < christopher.howard@frigidcode.com> wrote:
One of the things that I love about Haskell is the syntax for creating user defined types. E.g.:
Data QueryResult = NoResult | DatabaseError String | Results [String]
I can prototype an entire program around these self-made types and it is a lot of fun. Out of intellect curiosity, though: what would be the equivalent construction in C or C++? (Say, for the type defined above).
-- frigidcode.com theologia.indicium.us
______________________________**_________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/**mailman/listinfo/beginnershttp://www.haskell.org/mailman/listinfo/beginners
-- Michael Xavier http://www.michaelxavier.net LinkedIn http://www.linkedin.com/pub/michael-xavier/13/b02/a26