summaryrefslogtreecommitdiff
path: root/old/stdlib.hs
diff options
context:
space:
mode:
Diffstat (limited to 'old/stdlib.hs')
-rw-r--r--old/stdlib.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/old/stdlib.hs b/old/stdlib.hs
new file mode 100644
index 0000000..6f7334f
--- /dev/null
+++ b/old/stdlib.hs
@@ -0,0 +1,16 @@
+module Stdlib(stdlib) where
+
+import AST
+import Parser
+
+
+stdlib :: Program
+stdlib = fromRight $ parseProgram
+ "(define not (x) (= x 0))\n\
+ \(define id (x) x)\n\
+ \(define nil (x) (= x '()))\n\
+ \(define . (f g) (lambda (x) (f (g x))))\n"
+
+fromRight :: Show a => Either a b -> b
+fromRight (Right b) = b
+fromRight (Left a) = error $ "fromRight on Left: " ++ show a