diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-03-15 14:31:40 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-03-15 14:31:40 +1100 |
commit | e9134c3a46de1fc086fa87488c141b16cd828c02 (patch) | |
tree | d9d7143d2eb3daf0654149c5e1f1a48c97499312 /Unlambda | |
parent | 005d847234a84b58b1f2ef1baec8b3fdd238c2df (diff) |
Basic unlambda builtins implemented directly in haskell
Diffstat (limited to 'Unlambda')
-rw-r--r-- | Unlambda/Builtins.hs | 41 |
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) + |