From 4e434b328a0f6ddb0dc4ee333aa3135c1b271bf9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 1 Mar 2016 11:25:04 +0100 Subject: minor code cleanup --- tprint/src/Main.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tprint/src/Main.hs') diff --git a/tprint/src/Main.hs b/tprint/src/Main.hs index 5734e68..bc5ee2f 100644 --- a/tprint/src/Main.hs +++ b/tprint/src/Main.hs @@ -90,31 +90,31 @@ tprint TPrint{ operation = Printers, ..} Client{..} out = printers >>= format tprint TPrint{ operation = Jobs{..}, ..} Client{..} out = jobs printer jobRange timeRange >>= format where format js | (Human, _) <- output = mapM_ (\((JobId n), created, status) -> hPutStrLn out $ show n ++ "\t" ++ formatTime defaultTimeLocale "%Y-%m-%d %H:%M:%S %Z" created ++ "\t" ++ humanJobStatus status printer) . sortBy jSort $ toList js - | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty js - | otherwise = hPutStrLn out . dumpStr $ toList js + | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty js + | otherwise = hPutStrLn out . dumpStr $ toList js jSort (id, time, status) (id', time', status') = queueSort status status' <> compare time' time <> compare id id' tprint TPrint{ operation = Drafts, ..} Client{..} out = drafts >>= format where format ds | (Human, _) <- output = mapM_ (\(DraftId n, fromMaybe "" . fmap T.unpack -> t) -> hPutStrLn out $ show n ++ "\t" ++ t) $ Map.toAscList ds - | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty ds - | otherwise = hPutStrLn out . dumpStr $ Map.toAscList ds + | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty ds + | otherwise = hPutStrLn out . dumpStr $ Map.toAscList ds tprint TPrint{ operation = JobStatus{..}, ..} Client{..} out = jobStatus jobId >>= format where format s | (Human, _) <- output = hPutStrLn out $ humanJobStatus s Nothing - | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty s - | otherwise = hPutStrLn out $ dumpStr s + | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty s + | otherwise = hPutStrLn out $ dumpStr s tprint TPrint{ operation = Job{..}, ..} Client{..} out = job jobId >>= format where format p | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty p - | otherwise = T.hPutStrLn out =<< either throwM return (cobbcode p) + | otherwise = T.hPutStrLn out =<< either throwM return (cobbcode p) tprint TPrint{ operation = Draft{..}, ..} Client{..} out = draft draftId >>= format where format d@(fromMaybe "" . fmap T.unpack -> t, p) | (JSON, _) <- output = LCBS.hPutStrLn out $ encodePretty d - | otherwise = do + | otherwise = do hPutStrLn out t hPutStrLn out "" T.hPutStrLn out =<< either throwM return (cobbcode p) -- cgit v1.2.3