summaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 2205f77..4afb7fc 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -3,7 +3,7 @@ module Main (main) where
import Text.Pandoc hiding (handleError)
import XMLParse -- Our slightly modified copy of Text.XML.HaXml.Parse
-import System.IO (hSetBuffering, stdout, BufferMode (LineBuffering))
+import System.IO (hFlush, stdout)
import Text.XML.HaXml.Lex (xmlLex)
import Text.XML.HaXml.Posn (Posn ())
import Text.ParserCombinators.Poly.State (stGet)
@@ -32,12 +32,10 @@ rpcIn = map (either error id) . chop (xmlParseWith rpcMessage) .
xmlLex "<stdin>" <$> getContents
rpcOut :: [Document ()] -> IO ()
-rpcOut = mapM_ $ BSL8.putStrLn . XPP.document . escapeDoc
+rpcOut = mapM_ $ (<*) (hFlush stdout) . BSL8.putStr . XPP.document . escapeDoc
main :: IO ()
-main = do
- hSetBuffering stdout LineBuffering
- rpcOut . plugin =<< rpcIn
+main = rpcOut . plugin =<< rpcIn
plugin :: [Document Posn] -> [Document ()]
plugin [] = []