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