Advertisement
ttaaa

Main

Jan 24th, 2022
1,168
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Main where
  2.  
  3. import Control.Monad
  4.  
  5. import CalculatorParser
  6.  
  7. main :: IO ()
  8. main = forever $ do
  9.   putStr "> "
  10.   line <- getLine
  11.   case parseExpression line of
  12.     Left errorMessage -> putStrLn errorMessage
  13.     Right expr -> do
  14.         putStrLn . show $ expr
  15.         print . calculateExpression $ expr
  16.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement