Implement the pretty function

This commit is contained in:
Manuel Thalmann 2024-06-16 23:47:06 +02:00
parent 7e360c357e
commit c2ab01c161

View file

@ -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)"