summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-28 22:42:32 +1000
committerJed Barber <jjbarber@y7mail.com>2014-04-28 22:42:32 +1000
commit01b21135a76f38c9b4ce6129fe9c7368f02a405a (patch)
treeab5a75b6a0e56658e4e3647922e1d3756d1b7e3e /src
parenta0c0d197659eb12f9f22a154af2af7b50c57d57f (diff)
Simplifying slightly with Either monad
Diffstat (limited to 'src')
-rw-r--r--src/Unlambda/Parser.hs12
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"