@@ -27,6 +27,8 @@ module Data.UUID.Types.Internal
28 , fromWords
28 , fromWords
31 , buildFromBytes
33 , buildFromBytes
32 , buildFromWords
34 , buildFromWords
@@ -94,10 +96,15 @@ data UUID = UUID {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64
94 None was as fast, overall, as the representation used here.
96 None was as fast, overall, as the representation used here.
97−-- | Covert a 'UUID' into a sequence of 'Word32' values.
99+-- | Convert a 'UUID' into a sequence of 'Word32' values.
98-- Useful for when you need to serialize a UUID and
100-- Useful for when you need to serialize a UUID and
99-- neither 'Storable' nor 'Binary' are appropriate.
101-- neither 'Storable' nor 'Binary' are appropriate.
100−-- Introduced in version 1.2.2.
102+--
103+-- See also 'toWords64'.
105+-- /Since: @uuid-1.2.2@/
101toWords :: UUID -> (Word32, Word32, Word32, Word32)
108toWords :: UUID -> (Word32, Word32, Word32, Word32)
102toWords (UUID w12 w34) = (w1, w2, w3, w4)
109toWords (UUID w12 w34) = (w1, w2, w3, w4)
@@ -107,12 +114,33 @@ toWords (UUID w12 w34) = (w1, w2, w3, w4)
107 w4 = fromIntegral w34
114 w4 = fromIntegral w34
109-- | Create a 'UUID' from a sequence of 'Word32'. The
116-- | Create a 'UUID' from a sequence of 'Word32'. The
110−-- opposite of 'toWords'. Useful when you need a total
117+-- inverse of 'toWords'. Useful when you need a total
111-- function for constructing 'UUID' values.
118-- function for constructing 'UUID' values.
112−-- Introduced in version 1.2.2.
119+--
120+-- See also 'fromWords64'.
122+-- /Since: @uuid-1.2.2@/
113fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUID
125fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUID
114fromWords w1 w2 w3 w4 = UUID (w32to64 w1 w2) (w32to64 w3 w4)
126fromWords w1 w2 w3 w4 = UUID (w32to64 w1 w2) (w32to64 w3 w4)
128+-- | Convert a 'UUID' into a pair of 'Word64's.
130+-- See also 'toWords'.
133+toWords64 :: UUID -> (Word64, Word64)
134+toWords64 (UUID w12 w34) = (w12,w34)
136+-- | Create a 'UUID' from a pair of 'Word64's.
138+-- Inverse of 'toWords64'. See also 'fromWords'.
141+fromWords64 :: Word64 -> Word64 -> UUID
116data UnpackedUUID =
144data UnpackedUUID =
117 UnpackedUUID {
145 UnpackedUUID {
118 time_low :: Word32 -- 0-3
146 time_low :: Word32 -- 0-3