summaryrefslogtreecommitdiff
path: root/Unlambda
diff options
context:
space:
mode:
Diffstat (limited to 'Unlambda')
-rw-r--r--Unlambda/Builtins.hs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Unlambda/Builtins.hs b/Unlambda/Builtins.hs
new file mode 100644
index 0000000..118ca6f
--- /dev/null
+++ b/Unlambda/Builtins.hs
@@ -0,0 +1,41 @@
+module Unlambda.Builtins (
+ k,
+ s,
+ i,
+ dot,
+ r,
+ d
+ ) where
+
+
+
+
+k :: a -> b -> a
+k x y = x
+
+
+
+s :: (a -> b -> c) -> (a -> b) -> a -> c
+s x y z = (x z) (y z)
+
+
+
+i :: a -> a
+i = id
+
+
+
+dot :: Char -> a -> IO a
+dot ch f = putChar ch >> return f
+
+
+
+r :: a -> IO a
+r f = putChar '\n' >> return f
+
+
+
+-- may not work as per unlambda lazy semantics
+d :: (a -> b) -> (a -> b)
+d x = (\y -> x y)
+