summaryrefslogtreecommitdiff
path: root/src/Erebos/Object/Internal.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-10-27 22:08:47 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-11-06 21:06:49 +0100
commite0762612e95b0816721165c5aba6189809fcde58 (patch)
tree57a2b7eed322086e6e19bfa652798d3dceceb6f6 /src/Erebos/Object/Internal.hs
parent0bb8daa7da52240a971a4ce83d97cfb62971ea78 (diff)
ByteString conversion classes
Diffstat (limited to 'src/Erebos/Object/Internal.hs')
-rw-r--r--src/Erebos/Object/Internal.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Erebos/Object/Internal.hs b/src/Erebos/Object/Internal.hs
index 4a33dba..6f6fe6b 100644
--- a/src/Erebos/Object/Internal.hs
+++ b/src/Erebos/Object/Internal.hs
@@ -73,6 +73,7 @@ import Data.Word
import System.IO.Unsafe
+import ConvertByteString
import Crypto
import Erebos.Error
import Erebos.Storage.Internal
@@ -92,9 +93,9 @@ instance Eq (Ref' c) where
instance Show (Ref' c) where
show ref@(Ref st _) = show st ++ ":" ++ BC.unpack (showRef ref)
-instance BA.ByteArrayAccess (Ref' c) where
- length (Ref _ dgst) = BA.length dgst
- withByteArray (Ref _ dgst) = BA.withByteArray dgst
+instance ToByteString (Ref' c) where
+ withByteArray (Ref _ dgst) = withByteArray dgst
+ toByteString (Ref _ dgst) = toByteString dgst
instance Hashable (Ref' c) where
hashWithSalt salt = hashWithSalt salt . refDigest
@@ -117,7 +118,7 @@ zeroRef s = Ref s (RefDigest h)
digestAlgo = undefined
isZeroRef :: Ref' c -> Bool
-isZeroRef (Ref _ h) = all (==0) $ BA.unpack h
+isZeroRef (Ref _ h) = all (== 0) $ B.unpack $ toByteString h
refFromDigest :: Storage' c -> RefDigest -> IO (Maybe (Ref' c))