[Haskell-beginners] Basic "data" question
Costello, Roger L.
costello at mitre.org
Thu Nov 24 11:43:58 CET 2011
Hi Folks,
I am trying to define a data type for this:
A Lambda term is one of these:
- Variable
- Application of a Lambda term to a Lambda term
- Abstraction of a Variable in a Lambda term
Here's an example of a Lambda term:
term = Abstraction (Variable X) (Application (Variable X) (Variable Y))
Is there a way to define Lambda term?
Here's an attempt at defining it:
data Var = V | W | X | Y | Z
data Lambda = Variable Var | Application Lambda Lambda | Abstraction (Variable Var) Lambda
But that yields the following error:
test.hs:5:71: Not in scope: type constructor or class 'Variable'
Any suggestions would be much appreciated.
/Roger
More information about the Beginners
mailing list