From a93ff12905005d1cbd2339ddeb8e8abfe2b20079 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Aug 2017 14:43:56 -0400 Subject: avoid accidental Show of VectorClock Removed its Show instance. --- Logs/Presence/Pure.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Logs/Presence/Pure.hs') diff --git a/Logs/Presence/Pure.hs b/Logs/Presence/Pure.hs index 03cbdcdc1..8fc154177 100644 --- a/Logs/Presence/Pure.hs +++ b/Logs/Presence/Pure.hs @@ -9,7 +9,6 @@ module Logs.Presence.Pure where import Annex.Common import Annex.VectorClock -import Logs.TimeStamp import Logs.Line import Utility.QuickCheck @@ -19,7 +18,10 @@ data LogLine = LogLine { date :: VectorClock , status :: LogStatus , info :: String - } deriving (Eq, Show) + } deriving (Eq) + +instance Show LogLine where + show l = "LogLine " ++ formatVectorClock (date l) ++ show (status l) ++ " " ++ show (info l) data LogStatus = InfoPresent | InfoMissing | InfoDead deriving (Eq, Show, Bounded, Enum) @@ -29,12 +31,12 @@ parseLog :: String -> [LogLine] parseLog = mapMaybe parseline . splitLines where parseline l = LogLine - <$> (VectorClock <$> parsePOSIXTime d) + <$> parseVectorClock c <*> parseStatus s <*> pure rest where - (d, pastd) = separate (== ' ') l - (s, rest) = separate (== ' ') pastd + (c, pastc) = separate (== ' ') l + (s, rest) = separate (== ' ') pastc parseStatus :: String -> Maybe LogStatus parseStatus "1" = Just InfoPresent @@ -46,7 +48,7 @@ parseStatus _ = Nothing showLog :: [LogLine] -> String showLog = unlines . map genline where - genline (LogLine d s i) = unwords [show d, genstatus s, i] + genline (LogLine c s i) = unwords [formatVectorClock c, genstatus s, i] genstatus InfoPresent = "1" genstatus InfoMissing = "0" genstatus InfoDead = "X" -- cgit v1.2.3