@@ -19,6 +19,8 @@ module Data.UUID.Internal
1919 ,toByteString
2020 ,fromString
2121 ,toString
22+ ,fromWords
23+ ,toWords
2224 ,buildFromBytes
2325 ,buildFromWords
2426 ) where
@@ -68,6 +70,16 @@ data UUID = UUID !Word32 !Word32 !Word32 !Word32
6870 None was as fast, overall, as the representation used here.
6971-}
7072
73+-- | Covert a 'UUID' into a sequence of 'Word32' values.
74+-- Usefull for when you need to serialize a UUID and
75+-- neither 'Storable' nor 'Binary' are appropriate.
76+toWords :: UUID -> (Word32, Word32, Word32, Word32)
77+toWords (UUID w1 w2 w3 w4) = (w1, w2, w3, w4)
78+
79+-- | Create a 'UUID' from a sequence of 'Word32'. The
80+-- opposite of 'toWords'.
81+fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUID
82+fromWords = UUID
7183
7284--
7385-- UTILITIES