From 4e526431cbb2ab7916334a5ee03f2439b0534630 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 16 Mar 2014 01:24:29 +1100 Subject: Added c and e --- Unlambda/Builtins.hs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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) + -- cgit