From d6142115006893b806e313bb69b762f1afb3ea44 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 12 Mar 2014 23:25:41 +1100 Subject: Removed some superfluous do notation --- Unlambda/Interpreter.hs | 12 +++--------- 1 file 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 -- cgit