From e025614324f0d4a1abbc3ccc2d7cb54a34eeeb43 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Tue, 10 Jun 2025 09:13:40 -0400 Subject: [PATCH] Print extra newline if output text doesn't include a newline --- app/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Main.hs b/app/Main.hs index 957f9ba..5ca2c2d 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -24,4 +24,7 @@ main = do [] -> getContents x : _ -> readFile x let res = leftmostLongestParse parseDocument fileContents - print res + let toPrint = show res + case reverse toPrint of + '\n' : _ -> putStr toPrint + _ -> putStrLn toPrint