diff --git a/Exercises/exercise-7/Lambda.hs b/Exercises/exercise-7/Lambda.hs index 345d8db..a838fdf 100644 --- a/Exercises/exercise-7/Lambda.hs +++ b/Exercises/exercise-7/Lambda.hs @@ -4,3 +4,13 @@ data Term = | Inv Term Term -- EApp Invocation (a.k.a. Application) of a function | Var String -- EVar a variable | Add + +pretty x = case x of + (Abs name term) -> "L" ++ name ++ "." ++ pretty term + (Inv func param) -> "(" ++ pretty func ++ " " ++ pretty param ++ ")" + (Var name) -> name + Add -> "Add" + +-- example +-- >>> pretty (Abs "x" $ Abs "y" $ Inv (Inv Add (Var "x")) (Var "y")) +-- "Lx.Ly.((Add x) y)"