summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-16 01:24:29 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-16 01:24:29 +1100
commit4e526431cbb2ab7916334a5ee03f2439b0534630 (patch)
treed14dd2d06d68e45b6d8c76e130f2d176bba28afa
parente9134c3a46de1fc086fa87488c141b16cd828c02 (diff)
Added c and e
-rw-r--r--Unlambda/Builtins.hs23
1 files changed, 22 insertions, 1 deletions
diff --git a/Unlambda/Builtins.hs b/Unlambda/Builtins.hs
index 118ca6f..07f79a3 100644
--- a/Unlambda/Builtins.hs
+++ b/Unlambda/Builtins.hs
@@ -4,10 +4,21 @@ module Unlambda.Builtins (
i,
dot,
r,
- d
+ d,
+ c,
+ e
) where
+import Control.Exception( Exception(..), throw )
+
+
+
+data MyException = MyException { func :: a -> b }
+ deriving (Show, Eq)
+
+instance Exception MyException
+
k :: a -> b -> a
@@ -39,3 +50,13 @@ r f = putChar '\n' >> return f
d :: (a -> b) -> (a -> b)
d x = (\y -> x y)
+
+
+c :: (a -> b) -> (a -> b)
+c x = (`runCont` id) (callCC $ \cont -> x cont)
+
+
+
+e :: a -> b
+e x = throw (MyException x)
+