on master help sign in
Remove trailing whitespace in all .hs files
525b424Bardur Arantsson
Data/UUID/Builder.hs+3−3
@@ -10,14 +10,14 @@
10-- Portability : portable
10-- Portability : portable
11--
11--
12-- This module provides a system that can call a function that takes
12-- This module provides a system that can call a function that takes
13−-- a sequence of some number of Word8 arguments.
13+-- a sequence of some number of Word8 arguments.
14−--
14+--
15-- The twist is that the Word8 arguments can be supplied directly
15-- The twist is that the Word8 arguments can be supplied directly
16-- from Word8s, or from other sources that may provide more than
16-- from Word8s, or from other sources that may provide more than
17-- one Word8 apiece. Examples are Word16 and Word32 that supply
17-- one Word8 apiece. Examples are Word16 and Word32 that supply
18-- two and four Word8s respectively. Other ByteSource instances
18-- two and four Word8s respectively. Other ByteSource instances
19-- can be defined.
19-- can be defined.
20−--
20+--
21-- This module is admittedly overkill. There are only three places
21-- This module is admittedly overkill. There are only three places
22-- in the uuid package that need to call buildFromBytes with 16
22-- in the uuid package that need to call buildFromBytes with 16
23-- Word8 values, but each place uses Words of different lengths:
23-- Word8 values, but each place uses Words of different lengths:
Data/UUID/Internal.hs+7−8
@@ -142,13 +142,13 @@ unpack (UUID w0 w1 w2 w3) =
142
142
143pack :: UnpackedUUID -> UUID
143pack :: UnpackedUUID -> UUID
144pack unpacked =
144pack unpacked =
145− makeFromBytes /-/ (time_low unpacked)
145+ makeFromBytes /-/ (time_low unpacked)
146− /-/ (time_mid unpacked)
146+ /-/ (time_mid unpacked)
147− /-/ (time_hi_and_version unpacked)
147+ /-/ (time_hi_and_version unpacked)
148− /-/ (clock_seq_hi_res unpacked)
148+ /-/ (clock_seq_hi_res unpacked)
149 /-/ (clock_seq_low unpacked)
149 /-/ (clock_seq_low unpacked)
150− /-/ (node_0 unpacked) /-/ (node_1 unpacked)
150+ /-/ (node_0 unpacked) /-/ (node_1 unpacked)
151− /-/ (node_2 unpacked) /-/ (node_3 unpacked)
151+ /-/ (node_2 unpacked) /-/ (node_3 unpacked)
152 /-/ (node_4 unpacked) /-/ (node_5 unpacked)
152 /-/ (node_4 unpacked) /-/ (node_5 unpacked)
153
153
154
154
@@ -509,7 +509,7 @@ instance Storable UUID where
509
509
510instance Binary UUID where
510instance Binary UUID where
511 put (UUID w0 w1 w2 w3) =
511 put (UUID w0 w1 w2 w3) =
512− putWord32be w0 >> putWord32be w1 >> putWord32be w2 >> putWord32be w3
512+ putWord32be w0 >> putWord32be w1 >> putWord32be w2 >> putWord32be w3
513 get = liftM4 UUID getWord32be getWord32be getWord32be getWord32be
513 get = liftM4 UUID getWord32be getWord32be getWord32be getWord32be
514
514
515
515
@@ -527,4 +527,3 @@ uuidType = mkNoRepType "Data.UUID.UUID"
527mkNoRepType :: String -> DataType
527mkNoRepType :: String -> DataType
528mkNoRepType = mkNorepType
528mkNoRepType = mkNorepType
529#endif
529#endif
530−
Data/UUID/Util.hs+2−3
@@ -44,11 +44,10 @@ timeAndVersionToTime :: Word16 -> Word16
44timeAndVersionToTime tv = tv .&. 0x0FFF
44timeAndVersionToTime tv = tv .&. 0x0FFF
45
45
46extractMac :: UUID -> Maybe MAC
46extractMac :: UUID -> Maybe MAC
47−extractMac uuid =
47+extractMac uuid =
48 if version uuid == 1
48 if version uuid == 1
49− then Just $
49+ then Just $
50 MAC (node_0 unpacked) (node_1 unpacked) (node_2 unpacked) (node_3 unpacked) (node_4 unpacked) (node_5 unpacked)
50 MAC (node_0 unpacked) (node_1 unpacked) (node_2 unpacked) (node_3 unpacked) (node_4 unpacked) (node_5 unpacked)
51 else Nothing
51 else Nothing
52 where
52 where
53 unpacked = unpack uuid
53 unpacked = unpack uuid
54−
Data/UUID/V1.hs+1−4
@@ -61,7 +61,7 @@ makeUUID time clock mac' =
61 buildFromBytes 1 /-/ tLow /-/ tMid /-/ tHigh /-/ clock /-/ (MACSource mac')
61 buildFromBytes 1 /-/ tLow /-/ tMid /-/ tHigh /-/ clock /-/ (MACSource mac')
62 where tLow = (fromIntegral time) :: Word32
62 where tLow = (fromIntegral time) :: Word32
63 tMid = (fromIntegral (time `shiftR` 32)) :: Word16
63 tMid = (fromIntegral (time `shiftR` 32)) :: Word16
64− tHigh = (fromIntegral (time `shiftR` 48)) :: Word16
64+ tHigh = (fromIntegral (time `shiftR` 48)) :: Word16
65
65
66newtype MACSource = MACSource MAC
66newtype MACSource = MACSource MAC
67instance ByteSource MACSource where
67instance ByteSource MACSource where
@@ -133,6 +133,3 @@ hundredsOfNanosSinceGregorianReform t = floor $ 10000000 * dt
133 where
133 where
134 gregorianReform = UTCTime (fromGregorian 1582 10 15) 0
134 gregorianReform = UTCTime (fromGregorian 1582 10 15) 0
135 dt = t `diffUTCTime` gregorianReform
135 dt = t `diffUTCTime` gregorianReform
136−
137−
138−
Data/UUID/V3.hs−1
@@ -47,4 +47,3 @@ generateNamed :: UUID -- ^Namespace
47 -> [Word8] -- ^Object
47 -> [Word8] -- ^Object
48 -> UUID
48 -> UUID
49generateNamed = Shared.generateNamed MD5.hash 3
49generateNamed = Shared.generateNamed MD5.hash 3
50−
Data/UUID/V4.hs−1
@@ -26,4 +26,3 @@ import qualified System.Random as R
26-- | Generate a random UUID. Introduced in version 1.2.6.
26-- | Generate a random UUID. Introduced in version 1.2.6.
27nextRandom :: IO UUID
27nextRandom :: IO UUID
28nextRandom = R.randomIO
28nextRandom = R.randomIO
29−
Data/UUID/V5.hs−1
@@ -42,4 +42,3 @@ generateNamed :: UUID -- ^Namespace
42 -> [Word8] -- ^Object
42 -> [Word8] -- ^Object
43 -> UUID
43 -> UUID
44generateNamed = Shared.generateNamed SHA1.hash 5
44generateNamed = Shared.generateNamed SHA1.hash 5
45−
Data/Word/Util.hs+1−1
@@ -15,7 +15,7 @@ w8to32 w0s w1s w2s w3s =
15 w3 = fromIntegral w3s
15 w3 = fromIntegral w3s
16
16
17w8to16 :: Word8 -> Word8 -> Word16
17w8to16 :: Word8 -> Word8 -> Word16
18−w8to16 w0s w1s =
18+w8to16 w0s w1s =
19 (w0 `shiftL` 8) .|. w1
19 (w0 `shiftL` 8) .|. w1
20 where
20 where
21 w0 = fromIntegral w0s
21 w0 = fromIntegral w0s
Demo.hs−1
@@ -13,4 +13,3 @@ main = sequence_ $ replicate count $ do
13 x <- newUUID
13 x <- newUUID
14 y <- newUUID
14 y <- newUUID
15 seq (x == y) $ return ()
15 seq (x == y) $ return ()
16−
tests/BenchUUID.hs+2−3
@@ -74,7 +74,7 @@ main = do
74 bench "V5" $ nf (U5.generateNamed U5.namespaceURL) n1
74 bench "V5" $ nf (U5.generateNamed U5.namespaceURL) n1
75 ],
75 ],
76 bench "set making" $ nf Set.fromList uuids,
76 bench "set making" $ nf Set.fromList uuids,
77−
77+
78 bgroup "storable" [
78 bgroup "storable" [
79 bench "peek" $ nfIO (peek uuidPtr),
79 bench "peek" $ nfIO (peek uuidPtr),
80 bench "poke" $ poke uuidPtr u1
80 bench "poke" $ poke uuidPtr u1
@@ -83,7 +83,7 @@ main = do
83
83
84-- 50 uuids, so tests can be repeatable
84-- 50 uuids, so tests can be repeatable
85uuids :: [U.UUID]
85uuids :: [U.UUID]
86−uuids
86+uuids
87 = map (fromJust . U.fromString)
87 = map (fromJust . U.fromString)
88 [
88 [
89 "35d42593-1fca-4465-b588-a2e78cb996ba",
89 "35d42593-1fca-4465-b588-a2e78cb996ba",
@@ -137,4 +137,3 @@ uuids
137 "8091837c-6456-42c3-a686-f4731a41d4f9",
137 "8091837c-6456-42c3-a686-f4731a41d4f9",
138 "2a0e2efb-a11c-4a44-81ee-3efc37379b48"
138 "2a0e2efb-a11c-4a44-81ee-3efc37379b48"
139 ]
139 ]
140−