
24 Nov
2011
24 Nov
'11
7:26 a.m.
Hi Roger,
On 24 November 2011 10:43, Costello, Roger L.
data Var = V | W | X | Y | Z
data Lambda = Variable Var | Application Lambda Lambda | Abstraction (Variable Var) Lambda
Variable is a constructor of the data type Lambda. Abstraction is another. You use Variable as if it was a data type while defining Abstraction. data Lambda = Variable Var | Application Lambda Lambda | Abstraction Lambda Lambda You can use the above declaration to successfully create your example lambda terms. However, it doesn't stop you from constructing things like: Abstraction (Application .. ..) (Variable ..) If you want to go to that land, you either need smart constructors (simpler) or GADTs (more hairy, unfortunately). HTH, Ozgur