diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-04-28 22:42:32 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-04-28 22:42:32 +1000 |
commit | 01b21135a76f38c9b4ce6129fe9c7368f02a405a (patch) | |
tree | ab5a75b6a0e56658e4e3647922e1d3756d1b7e3e | |
parent | a0c0d197659eb12f9f22a154af2af7b50c57d57f (diff) |
Simplifying slightly with Either monad
-rw-r--r-- | src/Unlambda/Parser.hs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Unlambda/Parser.hs b/src/Unlambda/Parser.hs index 23bf723..4853d74 100644 --- a/src/Unlambda/Parser.hs +++ b/src/Unlambda/Parser.hs @@ -13,20 +13,14 @@ import Unlambda.Types parseUnlambda :: String -> Either ParseError UnlambdaTerm -parseUnlambda input = - let firstPass = parse removeComments "error" input - in case firstPass of - Left e -> Left e - Right o -> parse unlambda "error" o +parseUnlambda input = + parse removeComments "error" input >>= parse unlambda "error" parseUnlambda1 :: String -> Either ParseError UnlambdaTerm parseUnlambda1 input = - let firstPass = parse removeComments "error" input - in case firstPass of - Left e -> Left e - Right o -> parse unlambda1 "error" o + parse removeComments "error" input >>= parse unlambda1 "error" |