summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-12 23:25:41 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-12 23:25:41 +1100
commitd6142115006893b806e313bb69b762f1afb3ea44 (patch)
treeae8f4f2fe7f670ac77e16e8429e0b9a650bd2352
parent0649a52fe819a8a98b38d2c8d9c7a10af0597461 (diff)
Removed some superfluous do notation
-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