2008/5/17 Kaveh Shahbazian <[EMAIL PROTECTED]>: > I have question on mapping some Haskell concepts to C# 3 ones. Maybe there > are not any strict equivalents; yet it helps: > > 1 - What is the equivalent of "Type Constructor" in C#?
Class declaration. Generic ones. E.g. List<int>, is a type where the type constructor List has been applied to the type int. > > 2 - What is the equivalent of "Data Constructor" in C#? Constructors, I guess. > > 3 - What is the logical implementation of pattern matching in C#? (For > example using structures with indicator fields or using interfaces and > inheritance and dynamically dispatch in calling overloaded methods. Also > this question contain a hidden one...GADTs!) > You can use an abstract base class, and then inherit one class for each constructor (e.g. base class Expression, and concrete subclasses Mul, Add, etc.). Then you can use runtime type reflection to figure out which kind of Expression you have and branch on it. -- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe