diff options
Diffstat (limited to 'Main.hs')
-rw-r--r-- | Main.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,3 +1,4 @@ +{-# LANGUAGE LambdaCase, TupleSections #-} module Main where import System.Environment @@ -16,13 +17,12 @@ usage = do main :: IO () main = do - clargs <- getArgs - source <- case clargs of - [] -> getContents - [fname] -> readFile fname + (mfname, source) <- getArgs >>= \case + [] -> (Nothing,) <$> getContents + [arg] -> (Just arg,) <$> readFile arg _ -> usage >> exitFailure - prog <- parseProgram source >>= either (die . show) return + prog <- parseProgram mfname source >>= either (die . show) return irprog <- either die return (compileProgram prog) let opt = optimise irprog -- print opt |