]> git.rmz.io Git - my-scheme.git/commitdiff
Using the "bind" operator
authorSamir Benmendil <me@rmz.io>
Sun, 14 Jan 2018 16:55:02 +0000 (16:55 +0000)
committerSamir Benmendil <me@rmz.io>
Sun, 14 Jan 2018 16:55:02 +0000 (16:55 +0000)
The `do..` block seems easier

app/Main.hs

index 87b94aa3650c31697794c5e2c6c17706d88219ef..88ae7f7ff2ff0b439dcb452d24c2be9a66e55e41 100644 (file)
@@ -34,10 +34,9 @@ parseAtom = do
                 _    -> Atom atom
 
 parseNumber :: Parser LispVal
-parseNumber = do
-    ds <- many1 digit
-    let a = read ds
-    return $ Number a
+parseNumber = many1 digit >>= \ ds ->
+              let a = read ds
+              in return $ Number a
 
 parseExpr :: Parser LispVal
 parseExpr = parseString