improve a bit
This commit is contained in:
parent
d52c2b37ad
commit
014794f4ed
1 changed files with 12 additions and 3 deletions
|
@ -5,7 +5,13 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Logs.Chunk.Pure where
|
||||
module Logs.Chunk.Pure
|
||||
( ChunkSize
|
||||
, ChunkCount
|
||||
, ChunkLog
|
||||
, parseLog
|
||||
, showLog
|
||||
) where
|
||||
|
||||
import Common.Annex
|
||||
import Logs.MapLog
|
||||
|
@ -21,12 +27,15 @@ parseLog :: String -> ChunkLog
|
|||
parseLog = parseMapLog fieldparser valueparser
|
||||
where
|
||||
fieldparser s =
|
||||
let (u,sz) = separate (== ':') s
|
||||
let (u,sz) = separate (== sep) s
|
||||
in (,) <$> pure (toUUID u) <*> readish sz
|
||||
valueparser = readish
|
||||
|
||||
showLog :: ChunkLog -> String
|
||||
showLog = showMapLog fieldshower valueshower
|
||||
where
|
||||
fieldshower (u, sz) = fromUUID u ++ ':' : show sz
|
||||
fieldshower (u, sz) = fromUUID u ++ sep : show sz
|
||||
valueshower = show
|
||||
|
||||
sep :: Char
|
||||
sep = ':'
|
||||
|
|
Loading…
Add table
Reference in a new issue