Skip to content

Commit

Permalink
DoAndIfThenElse
Browse files Browse the repository at this point in the history
  • Loading branch information
lennart-augustsson-epicgames committed Mar 25, 2024
1 parent fd5e674 commit ef1b2c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Differences:
* Always enabled extension:
* BangPatterns
* ConstraintKinds
* DoAndIfThenElse
* DuplicateRecordFields
* EmptyDataDecls
* ExistentialQuantification
Expand Down
13 changes: 6 additions & 7 deletions src/MicroHs/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ main :: IO ()
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)
Expand All @@ -49,7 +48,7 @@ decodeArgs :: Flags -> [String] -> [String] -> (Flags, [String], [String])
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
Expand Down

0 comments on commit ef1b2c7

Please sign in to comment.