Skip to content

Commit 7aecf4b

Browse files
committed
Inline 'App.hs/fromFile' to improve code clarity
1 parent db4f7be commit 7aecf4b

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
@@ -238,16 +238,15 @@ main = do
238238
([TextIRMode], [], []) -> fromStdinTextIR
239239
([JSONIRMode], [], []) -> fromStdinJsonIR
240240

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

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

250-
251250
-- Check options for consistency
252251
optionsOK :: [Flag] -> Bool
253252
optionsOK o | length o >=2 =
@@ -256,13 +255,6 @@ main = do
256255
optionsOK _ = True
257256

258257

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

268260
hrWidth = 70

0 commit comments

Comments
 (0)