`readExpr :: String -> String` defines `readExpr` to be a function
(`->`) from String to a String.
`readExpr input = ...` will assign anything on the rhs to the `readExpr`
function where `input` is mapped to the first parameter of that
function.
`case ... of` is a *filter*.
`parse a b c` is a function from Parsec where `a` is the parser it should
use, `b` is the name of the input which is used for error messages and
`c` is the String to parse.
`parse` returns an `Either` type whose `Left` constructor indicates an
error. If we get a `Right` value, we bind it to `val`, ignore it and
return the String "Found Value".
symbol :: Parser Char
symbol = oneOf "!#$%&|*+-/:<=>?@^_~"
+readExpr :: String -> String
+readExpr input = case parse symbol "lisp" input of
+ Left err -> "No match: " ++ show err
+ Right val -> "Found value"
+
main :: IO ()
main = do
args <- getLine
- putStrLn (args)
+ putStrLn (readExpr args)