@@ -33,19 +33,21 @@ import Data.Binary.Get (runGet, getWord32be)
33import Data.Maybe
33import Data.Maybe
34import Data.Word (Word8)
34import Data.Word (Word8)
36+import qualified Data.ByteArray as BA
36import qualified Data.ByteString as B
37import qualified Data.ByteString as B
37import qualified Data.ByteString.Lazy as BL
38import qualified Data.ByteString.Lazy as BL
39-- |Generate a 'UUID' within the specified namespace out of the given
40-- |Generate a 'UUID' within the specified namespace out of the given
42+generateNamed :: BA.ByteArrayAccess bs
41−generateNamed :: (B.ByteString -> B.ByteString) -- ^Hash
43+ => (B.ByteString -> bs) -- ^Hash
42 -> Word8 -- ^Version
44 -> Word8 -- ^Version
43 -> UUID -- ^Namespace
45 -> UUID -- ^Namespace
44 -> [Word8] -- ^Object
46 -> [Word8] -- ^Object
46generateNamed hash version namespace object =
48generateNamed hash version namespace object =
47 let chunk = B.pack $ toList namespace ++ object
49 let chunk = B.pack $ toList namespace ++ object
48− bytes = BL.fromChunks . (:[]) $ hash chunk
50+ bytes = BL.fromStrict . BA.convert $ hash chunk
49 w = getWord32be
51 w = getWord32be
50 unpackBytes = runGet $
52 unpackBytes = runGet $
51 buildFromWords version <$> w <*> w <*> w <*> w
53 buildFromWords version <$> w <*> w <*> w <*> w