]> git.rmz.io Git - my-scheme.git/blobdiff - app/Main.hs
Parse Numbers
[my-scheme.git] / app / Main.hs
index 6fcf6675f175374d22b749097dc06142312b8400..6daf522b2c86598881760fa72c242009d8516092 100644 (file)
@@ -1,4 +1,5 @@
 module Main where
+import Control.Monad
 import Text.ParserCombinators.Parsec hiding (spaces)
 import System.Environment
 
@@ -32,6 +33,9 @@ parseAtom = do
                 "#f" -> Bool False
                 _    -> Atom atom
 
+parseNumber :: Parser LispVal
+parseNumber = liftM (Number . read) $ many1 digit
+
 readExpr :: String -> String
 readExpr input = case parse (spaces >> symbol) "lisp" input of
     Left err -> "No match: " ++ show err