summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-11-18 18:35:40 +0100
committertomsmeding <tom.smeding@gmail.com>2019-11-18 18:35:40 +0100
commit4746aa52f85f4dc3ce8e195f0a5fd8afe2d54378 (patch)
tree2bf667797ad0fe583091860f17c742d5de3c3f18 /Main.hs
parent095970d60c7912d330c7c33501a1634c533eced1 (diff)
Fix includes relative to lisp file
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Main.hs b/Main.hs
index b56edfe..ef98b62 100644
--- a/Main.hs
+++ b/Main.hs
@@ -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