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.
|
- 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 Common.Annex
|
||||||
import Logs.MapLog
|
import Logs.MapLog
|
||||||
|
@ -21,12 +27,15 @@ parseLog :: String -> ChunkLog
|
||||||
parseLog = parseMapLog fieldparser valueparser
|
parseLog = parseMapLog fieldparser valueparser
|
||||||
where
|
where
|
||||||
fieldparser s =
|
fieldparser s =
|
||||||
let (u,sz) = separate (== ':') s
|
let (u,sz) = separate (== sep) s
|
||||||
in (,) <$> pure (toUUID u) <*> readish sz
|
in (,) <$> pure (toUUID u) <*> readish sz
|
||||||
valueparser = readish
|
valueparser = readish
|
||||||
|
|
||||||
showLog :: ChunkLog -> String
|
showLog :: ChunkLog -> String
|
||||||
showLog = showMapLog fieldshower valueshower
|
showLog = showMapLog fieldshower valueshower
|
||||||
where
|
where
|
||||||
fieldshower (u, sz) = fromUUID u ++ ':' : show sz
|
fieldshower (u, sz) = fromUUID u ++ sep : show sz
|
||||||
valueshower = show
|
valueshower = show
|
||||||
|
|
||||||
|
sep :: Char
|
||||||
|
sep = ':'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue