newtype MapLog
authorJoey Hess <joeyh@joeyh.name>
Mon, 13 Nov 2023 18:16:55 +0000 (14:16 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 13 Nov 2023 18:37:22 +0000 (14:37 -0400)
commit38b9ebc5fd15188beddf637aa355238afd1a047d
tree63c82386058aa6ca3c99c542e6cbc8df72eece0e
parent5d8b8a8ad0b7f213cb38242daa667b5a4bfa252d
newtype MapLog

Noticed that Semigroup instance of Map is not suitable to use
for MapLog. For example, it behaved like this:

ghci>  parseTrustLog "foo 1 timestamp=10\nfoo 2 timestamp=11" <> parseTrustLog "foo X timestamp=12"
fromList [(UUID "foo",LogEntry {changed = VectorClock 11s, value = SemiTrusted})]

Which was wrong, it lost the newer DeadTrusted value.

Luckily, nothing used that Semigroup when operating on a MapLog. And this
provides a safe instance.

Sponsored-by: Graham Spencer on Patreon
Annex/Branch/Transitions.hs
Command/Expire.hs
Logs/Chunk.hs
Logs/Export.hs
Logs/MapLog.hs
Logs/RemoteState.hs
Logs/Trust/Pure.hs
Logs/UUIDBased.hs