on master help sign in
-Wall cleaner
9663b9aAntoine Latter
Data/UUID/Named.hs−3
@@ -33,9 +33,6 @@ import Data.Maybe
33
33
34import qualified Data.ByteString.Lazy as BS
34import qualified Data.ByteString.Lazy as BS
35
35
36−import qualified Data.Digest.SHA1 as SHA1
37−
38−
39-- |Generate a 'UUID' within the specified namespace out of the given
36-- |Generate a 'UUID' within the specified namespace out of the given
40-- object.
37-- object.
41generateNamed :: ([Word8] -> (Word32, Word32, Word32, Word32)) -- ^Hash
38generateNamed :: ([Word8] -> (Word32, Word32, Word32, Word32)) -- ^Hash
Data/UUID/V3.hs+3−1
@@ -48,6 +48,7 @@ hash :: [Word8] -> (Word32, Word32, Word32, Word32)
48hash bytes
48hash bytes
49 = case map f $ chunk 4 $ MD5.hash bytes of
49 = case map f $ chunk 4 $ MD5.hash bytes of
50 w1:w2:w3:w4:_ -> (w1, w2, w3, w4)
50 w1:w2:w3:w4:_ -> (w1, w2, w3, w4)
51+ _ -> error "Data.UUID.V3.hash: fatal error"
51
52
52 where f [b1, b2, b3, b4]
53 where f [b1, b2, b3, b4]
53 = sum
54 = sum
@@ -56,9 +57,10 @@ hash bytes
56 , fromIntegral b2 `shiftL` 16
57 , fromIntegral b2 `shiftL` 16
57 , fromIntegral b1 `shiftL` 24
58 , fromIntegral b1 `shiftL` 24
58 ]
59 ]
60+ f _ = error "Data.UUID.V3.hash: fatal error"
59
61
60chunk :: Int -> [a] -> [[a]]
62chunk :: Int -> [a] -> [[a]]
61−chunk n xs = go n [] xs
63+chunk n = go n []
62 where go _ [] [] = []
64 where go _ [] [] = []
63 go _ ys [] = reverse ys:[]
65 go _ ys [] = reverse ys:[]
64 go 0 ys xs = reverse ys:go n [] xs
66 go 0 ys xs = reverse ys:go n [] xs