diff options
Diffstat (limited to 'Unlambda')
-rw-r--r-- | Unlambda/Builtins.hs | 23 |
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) + |