ref: ef1b2c769da8967f1273330cc60cdf04f5a8a62f
parent: fd5e674fa65ff997cf004a5c4a0bf17fbff68340
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Mar 25 09:09:31 EDT 2024
DoAndIfThenElse
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@
* Always enabled extension:
* BangPatterns
* ConstraintKinds
+ * DoAndIfThenElse
* DuplicateRecordFields
* EmptyDataDecls
* ExistentialQuantification
--- a/src/MicroHs/Main.hs
+++ b/src/MicroHs/Main.hs
@@ -30,13 +30,12 @@
main = do
args <- getArgs
dir <- fromMaybe "." <$> getMhsDir
- if take 1 args == ["--version"] then
- putStrLn $ "MicroHs, version " ++ mhsVersion ++ ", combinator file version " ++ combVersion
- else if take 1 args == ["--numeric-version"] then
- putStrLn mhsVersion
- else do
+ case take 1 args of
+ ["--version"] -> putStrLn $ "MicroHs, version " ++ mhsVersion ++ ", combinator file version " ++ combVersion
+ ["--numeric-version"] -> putStrLn mhsVersion
+ _ -> do
let (flags, mdls, rargs) = decodeArgs (defaultFlags dir) [] args
- withArgs rargs $ -- leave arguments after -- for any program we run
+ withArgs rargs $
case mdls of
[] -> mainInteractive flags
[s] -> mainCompile flags (mkIdentSLoc (SLoc "command-line" 0 0) s)
@@ -49,7 +48,7 @@
decodeArgs f mdls [] = (f, mdls, [])
decodeArgs f mdls (arg:args) =
case arg of
- "--" -> (f, mdls, args)
+ "--" -> (f, mdls, args) -- leave arguments after -- for any program we run
"-v" -> decodeArgs f{verbose = verbose f + 1} mdls args "-r" -> decodeArgs f{runIt = True} mdls args "-l" -> decodeArgs f{loading = True} mdls args--
⑨