<br><br><div class="gmail_quote">2011/11/24  <span dir="ltr">&lt;<a href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Send Beginners mailing list submissions to<br>
        <a href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:beginners-owner@haskell.org">beginners-owner@haskell.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of Beginners digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1.  Basic &quot;data&quot; question (Costello, Roger L.)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 24 Nov 2011 10:43:58 +0000<br>
From: &quot;Costello, Roger L.&quot; &lt;<a href="mailto:costello@mitre.org">costello@mitre.org</a>&gt;<br>
Subject: [Haskell-beginners] Basic &quot;data&quot; question<br>
To: &quot;<a href="mailto:beginners@haskell.org">beginners@haskell.org</a>&quot; &lt;<a href="mailto:beginners@haskell.org">beginners@haskell.org</a>&gt;<br>
Message-ID:<br>
        &lt;<a href="mailto:B5FEE00B53CF054AA8439027E8FE1775181911E9@IMCMBX04.MITRE.ORG">B5FEE00B53CF054AA8439027E8FE1775181911E9@IMCMBX04.MITRE.ORG</a>&gt;<br>
Content-Type: text/plain; charset=&quot;us-ascii&quot;<br>
<br>
Hi Folks,<br>
<br>
I am trying to define a data type for this:<br>
<br>
    A Lambda term is one of these:<br>
        - Variable<br>
        - Application of a Lambda term to a Lambda term<br>
        - Abstraction of a Variable in a Lambda term<br>
<br>
Here&#39;s an example of a Lambda term:<br>
<br>
term = Abstraction (Variable X) (Application (Variable X) (Variable Y))<br>
<br>
Is there a way to define Lambda term?<br>
<br>
Here&#39;s an attempt at defining it:<br>
<br>
data Var = V | W | X | Y | Z<br>
<br>
data Lambda = Variable Var | Application Lambda Lambda | Abstraction (Variable Var) Lambda<br>
<br>
But that yields the following error:<br>
<br>
test.hs:5:71: Not in scope: type constructor or class &#39;Variable&#39;<br>
<br>
Any suggestions would be much appreciated.<br>
<br>
/Roger<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br>
<br>
End of Beginners Digest, Vol 41, Issue 33<br>
*****************************************<br>
</blockquote></div><font color="#222222" face="arial, sans-serif">value constructor  followed by types.</font>  And (Variable Var)  <h3 class="r" style="font-size: medium; font-weight: normal; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 1; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(34, 34, 34); font-family: arial, sans-serif; background-color: rgb(255, 255, 255); ">
belong to <span style="background-color: transparent; ">Lambda type.</span></h3><div><span style="background-color: transparent; "><br></span></div><div>Could define like this:</div><div>data Lambda var= Variable var | Application (Lambda var) (Lambda var)</div>
<div><br></div><div>var be any types</div>