Skip to content

Commit 8e08131

Browse files
committed
Inline 'App.hs/fromFile' to improve code clarity
1 parent 73d0632 commit 8e08131

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

compiler/app/Main.hs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,15 @@ main = do
239239
([TextIRMode], [], []) -> fromStdinTextIR
240240
([JSONIRMode], [], []) -> fromStdinJsonIR
241241

242-
(o, [file], []) | optionsOK o ->
243-
fromFile o file
244-
242+
(o, [file], []) | optionsOK o -> do
243+
input <- readFile file
244+
process o (Just file) input
245245

246246
(_,_, errs) -> die $ concat errs ++ compilerUsage
247247
where
248248
compilerUsage = usageInfo header options
249249
where header = "Usage: <compiler> [OPTION...] file"
250250

251-
252251
-- Check options for consistency
253252
optionsOK :: [Flag] -> Bool
254253
optionsOK o | length o >=2 =
@@ -257,13 +256,6 @@ main = do
257256
optionsOK _ = True
258257

259258

260-
261-
fromFile :: [Flag] -> String -> IO ExitCode
262-
fromFile flags fname = do
263-
input <- readFile fname
264-
process flags (Just fname) input
265-
266-
267259
-- utility functions for printing things out
268260

269261
hrWidth = 70

0 commit comments

Comments
 (0)