<br><br><div class="gmail_quote">2008/5/17 Kaveh Shahbazian &lt;<a href="mailto:kaveh.shahbazian@gmail.com">kaveh.shahbazian@gmail.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have question on mapping some Haskell concepts to C# 3 ones. Maybe there are not any strict equivalents; yet it helps:<br><br>1 - What is the equivalent of &quot;Type Constructor&quot; in C#?</blockquote><div><br>Class declaration. Generic ones. E.g. List&lt;int&gt;, is a type where the type constructor List has been applied to the type int.<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>2 - What is the equivalent of &quot;Data Constructor&quot; in C#?</blockquote><div>
<br>Constructors, I guess.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
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!)<br>

</blockquote><div><br>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.<br>
<br></div></div><br clear="all"><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862