summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--calculator.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/calculator.hs b/calculator.hs
new file mode 100644
index 0000000..7753022
--- /dev/null
+++ b/calculator.hs
@@ -0,0 +1,16 @@
+import Text.Parsec
+import Text.Parsec.String
+
+calculation :: Parser Int
+calculation = return undefined
+
+calculate :: String -> String
+calculate s =
+ case ret of
+ Left e -> "error: " ++ (show e)
+ Right n -> "answer: " ++ (show n)
+ where
+ ret = parse calculation "" s
+
+main :: IO ()
+main = interact (unlines . (map calculate) . lines)