on master help sign in
Add functions fromWords/toWords, bump version
efa8fa8Antoine Latter
Data/UUID.hs+2
@@ -22,6 +22,8 @@ module Data.UUID(UUID
22 ,fromString
22 ,fromString
23 ,toByteString
23 ,toByteString
24 ,fromByteString
24 ,fromByteString
25+ ,toWords
26+ ,fromWords
25 ,null
27 ,null
26 ,nil
28 ,nil
27 ) where
29 ) where
Data/UUID/Internal.hs+12
@@ -19,6 +19,8 @@ module Data.UUID.Internal
19 ,toByteString
19 ,toByteString
20 ,fromString
20 ,fromString
21 ,toString
21 ,toString
22+ ,fromWords
23+ ,toWords
22 ,buildFromBytes
24 ,buildFromBytes
23 ,buildFromWords
25 ,buildFromWords
24 ) where
26 ) where
@@ -68,6 +70,16 @@ data UUID = UUID !Word32 !Word32 !Word32 !Word32
68 None was as fast, overall, as the representation used here.
70 None was as fast, overall, as the representation used here.
69-}
71-}
70
72
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
71
83
72--
84--
73-- UTILITIES
85-- UTILITIES
uuid.cabal+2−2
@@ -1,6 +1,6 @@
1Name: uuid
1Name: uuid
2−Version: 1.2.1
2+Version: 1.2.2
3−Copyright: (c) 2008-2010 Antoine Latter
3+Copyright: (c) 2008-2011 Antoine Latter
4Author: Antoine Latter
4Author: Antoine Latter
5Maintainer: aslatter@gmail.com
5Maintainer: aslatter@gmail.com
6License: BSD3
6License: BSD3