diff options
author | Daniel Firth <locallycompact@gmail.com> | 2018-06-29 14:52:28 +0100 |
---|---|---|
committer | Daniel Firth <locallycompact@gmail.com> | 2018-07-04 09:50:16 +0100 |
commit | e5b68e4909cdb4c9b13a4855c4609df592346897 (patch) | |
tree | 611603accc9193a0b5df77a95e28f004fd28eea8 | |
parent | 4c5bc5fc76f492382bb8f1444e9aa29294af0251 (diff) |
Fix hlint errors in Stats.hs
-rw-r--r-- | Bustle/Stats.hs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Bustle/Stats.hs b/Bustle/Stats.hs index 0ef7b19..45083bd 100644 --- a/Bustle/Stats.hs +++ b/Bustle/Stats.hs @@ -31,7 +31,7 @@ module Bustle.Stats where import Control.Monad (guard) -import Data.List (sort, sortBy) +import Data.List (sortBy) import Data.Maybe (mapMaybe) import Data.Ord (comparing) @@ -62,9 +62,7 @@ data FrequencyInfo = deriving (Show, Eq, Ord) frequencies :: Log -> [FrequencyInfo] -frequencies = reverse - . sort - . map (\((t, i, m), c) -> FrequencyInfo c t i m) +frequencies = sortBy (flip compare) . map (\((t, i, m), c) -> FrequencyInfo c t i m) . Map.toList . foldr (Map.alter alt) Map.empty . mapMaybe repr @@ -86,9 +84,7 @@ data TimeInfo = methodTimes :: Log -> [TimeInfo] -methodTimes = reverse - . sortBy (comparing tiTotalTime) - . map summarize +methodTimes = sortBy (flip (comparing tiTotalTime)) . map summarize . Map.toList . foldr (\(i, method, time) -> Map.alter (alt time) (i, method)) Map.empty @@ -101,7 +97,7 @@ methodTimes = reverse Just (newtime + total, newtime : times) isReturn :: Message -> Bool - isReturn (MethodReturn {}) = True + isReturn MethodReturn {} = True isReturn _ = False methodReturn :: Detailed Message @@ -109,7 +105,7 @@ methodTimes = reverse methodReturn dm = do let m = deEvent dm guard (isReturn m) - Detailed start (call@(MethodCall {})) _ _ <- inReplyTo m + Detailed start call@(MethodCall {}) _ _ <- inReplyTo m return ( iface (member call) , membername (member call) , deTimestamp dm - start @@ -120,7 +116,7 @@ methodTimes = reverse , tiMethodName = method , tiTotalTime = fromIntegral total / 1000 , tiCallFrequency = length times - , tiMeanCallTime = (mean $ map fromIntegral times) / 1000 + , tiMeanCallTime = mean (map fromIntegral times) / 1000 } -- FIXME: really? again? @@ -145,7 +141,7 @@ data SizeInfo = messageSizes :: Log -> [SizeInfo] messageSizes messages = - reverse . sort . map summarize $ Map.assocs sizeTable + sortBy (flip compare) . map summarize $ Map.assocs sizeTable where summarize :: ((SizeType, Maybe InterfaceName, MemberName), [Int]) -> SizeInfo summarize ((t, i, m), sizes) = |