From 6c822b4ad005701cfafe3edfeb185c5300d80876 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 16 May 2023 10:35:49 -0400
Subject: [PATCH] HashChain can be a Semigroup because it just carries a list

---
 src/Tahoe/SDMF/Internal/Share.hs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/Tahoe/SDMF/Internal/Share.hs b/src/Tahoe/SDMF/Internal/Share.hs
index 0bbad62..d370bbc 100644
--- a/src/Tahoe/SDMF/Internal/Share.hs
+++ b/src/Tahoe/SDMF/Internal/Share.hs
@@ -24,7 +24,7 @@ hashSize = 32
 newtype HashChain = HashChain
     { hashChain :: [(Word16, B.ByteString)]
     }
-    deriving newtype (Eq, Show)
+    deriving newtype (Eq, Show, Semigroup)
 
 instance Binary HashChain where
     put (HashChain []) = mempty
@@ -40,8 +40,7 @@ instance Binary HashChain where
             else do
                 n <- getWord16be
                 h <- getByteString hashSize
-                (HashChain c) <- get
-                pure $ HashChain ((n, h) : c)
+                (HashChain [(n, h)] <>) <$> get
 
 {- | Structured representation of a single version SDMF share.
 
-- 
GitLab