summaryrefslogtreecommitdiff
path: root/src/Storage.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Storage.hs')
-rw-r--r--src/Storage.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Storage.hs b/src/Storage.hs
index f9d302e..c31230e 100644
--- a/src/Storage.hs
+++ b/src/Storage.hs
@@ -107,6 +107,10 @@ data Ref = Ref Storage (Digest Blake2b_256)
instance Show Ref where
show ref@(Ref (Storage path) _) = path ++ ":" ++ BC.unpack (showRef ref)
+instance BA.ByteArrayAccess Ref where
+ length (Ref _ dgst) = BA.length dgst
+ withByteArray (Ref _ dgst) = BA.withByteArray dgst
+
zeroRef :: Storage -> Ref
zeroRef s = Ref s h
where h = case digestFromByteString $ B.replicate (BA.length h) 0 of