summaryrefslogtreecommitdiff
path: root/Unlambda/Interpreter.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Unlambda/Interpreter.hs')
-rw-r--r--Unlambda/Interpreter.hs12
1 files changed, 3 insertions, 9 deletions
diff --git a/Unlambda/Interpreter.hs b/Unlambda/Interpreter.hs
index 63eab37..1f0be35 100644
--- a/Unlambda/Interpreter.hs
+++ b/Unlambda/Interpreter.hs
@@ -50,8 +50,7 @@ apply firstTerm secondTerm =
Sapp x y -> do
z <- eval secondTerm
- result <- eval (App (App x z) (App y z))
- return result
+ eval (App (App x z) (App y z))
I -> eval secondTerm
@@ -63,10 +62,7 @@ apply firstTerm secondTerm =
D -> return (Promise secondTerm)
- Promise x -> do
- y <- eval secondTerm
- result <- eval (App x y)
- return result
+ Promise x -> eval secondTerm >>= eval . (App x)
Dot c -> do
t <- eval secondTerm
@@ -78,9 +74,7 @@ apply firstTerm secondTerm =
liftIO (putChar '\n')
return t
- E -> do
- t <- eval secondTerm
- throw (UnlambdaException t)
+ E -> eval secondTerm >>= throw . UnlambdaException
Reed -> return I --do
--t <- eval ch secondTerm