From e9134c3a46de1fc086fa87488c141b16cd828c02 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 15 Mar 2014 14:31:40 +1100 Subject: Basic unlambda builtins implemented directly in haskell --- Unlambda/Builtins.hs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Unlambda/Builtins.hs 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) + -- cgit