summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
new file mode 100644
index 0000000..e5aa512
--- /dev/null
+++ b/Main.hs
@@ -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)