diff options
author | 2017-08-14 14:43:56 -0400 | |
---|---|---|
committer | 2017-08-14 14:51:54 -0400 | |
commit | a93ff12905005d1cbd2339ddeb8e8abfe2b20079 (patch) | |
tree | 79dcabdc88b955bfcfa46735fae666be87d6dae3 /Annex | |
parent | aecfea27593bc121273fe53a6c11d4a22567004f (diff) |
avoid accidental Show of VectorClock
Removed its Show instance.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/VectorClock.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Annex/VectorClock.hs b/Annex/VectorClock.hs index 24a6bd1fd..c7f6d6336 100644 --- a/Annex/VectorClock.hs +++ b/Annex/VectorClock.hs @@ -21,7 +21,7 @@ import Utility.QuickCheck -- | Some very old logs did not have any time stamp at all; -- Unknown is used for those. data VectorClock = Unknown | VectorClock POSIXTime - deriving (Eq, Ord, Show) + deriving (Eq, Ord) -- Unknown is oldest. prop_VectorClock_sane :: Bool @@ -37,3 +37,10 @@ currentVectorClock = go =<< getEnv "GIT_ANNEX_VECTOR_CLOCK" go (Just s) = case parsePOSIXTime s of Just t -> return (VectorClock t) Nothing -> VectorClock <$> getPOSIXTime + +formatVectorClock :: VectorClock -> String +formatVectorClock Unknown = "0" +formatVectorClock (VectorClock t) = show t + +parseVectorClock :: String -> Maybe VectorClock +parseVectorClock t = VectorClock <$> parsePOSIXTime t |