Write Lambda types and expressions.
Writes a Lambda expression into a text representation.
import Lambda exposing (Expr(..))
import Lambda.Write
-- Values
Lambda.Write.expression (Int 42) --> "42"
Lambda.Write.expression (Num 3.14) --> "3.14"
-- Variables
Lambda.Write.expression (Var "x") --> "x"
-- Abstractions
Lambda.Write.expression (Abs "x" (Var "y")) --> "λx.y"
Lambda.Write.expression (Abs "x" (Abs "y" (Var "z"))) --> "λx.λy.z"
-- Applications
Lambda.Write.expression (App (Var "f") (Var "x")) --> "f x"
Lambda.Write.expression (App (App (Var "f") (Var "x")) (Var "y")) --> "f x y"
Lambda.Write.expression (App (Var "f") (App (Var "x") (Var "y"))) --> "f (x y)"
Lambda.Write.expression (Abs "x" (App (Var "y") (Var "z"))) --> "λx.y z"
-- Variable definitions (syntax sugar)
Lambda.Write.expression (App (Abs "x" (Var "z")) (Var "y")) --> "x=y; z"
Writes a Lambda type into a text representation.