diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-12-26 18:08:15 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-12-26 18:08:15 +0100 |
commit | 5d1d3b4f251bf938648d7d21c6641a1a0cc0768b (patch) | |
tree | e237fff9f493c0acc4154c6e77f1a7c3d0f6365f /Main.hs |
Initial
Diffstat (limited to 'Main.hs')
-rw-r--r-- | Main.hs | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +module Main where + +import Eval (eval) +import Language +import Show (showExpr) +import Simplify (simplify) + + +main :: IO () +main = do + print . eval $ + let_ (add (con (2 :: Int)) (con 3)) $ \_ x -> + mul x x + + let prog = + let_ (add (con (2 :: Int)) (con 3)) $ \_ x -> + let_ (mul (con (4 :: Int)) (con 5)) $ \wy y -> + let_ (pair (wy x) y) $ \wt t -> + add (mul (wt (wy x)) (snd_ t)) (mul (wt y) (fst_ t)) + putStrLn (showExpr prog) + putStrLn (showExpr (simplify prog)) + print (eval prog) |