@@ -12,7 +12,9 @@
13module Data.UUID.Internal
13module Data.UUID.Internal
16 ,nodeToList
18 ,nodeToList
17 ,listToNode
19 ,listToNode
18 ,fromString
20 ,fromString
@@ -22,6 +24,9 @@ module Data.UUID.Internal
27+import Prelude hiding (null)
28+import qualified Prelude
25import Data.Word
30import Data.Word
26import Data.Char
31import Data.Char
27import Data.Maybe
32import Data.Maybe
@@ -66,6 +71,11 @@ data UUID = UUID
66 ,uuid_node :: SLOT(Node)
71 ,uuid_node :: SLOT(Node)
67 } deriving (Eq, Ord, Typeable)
72 } deriving (Eq, Ord, Typeable)
74+-- |Returns true if the passed-in UUID is the null UUID.
76+null (UUID 0 0 0 0 0 node) | nullNode node = True
69instance Random UUID where
79instance Random UUID where
70 random g = let (timeLow, g1) = randomBoundedIntegral g
80 random g = let (timeLow, g1) = randomBoundedIntegral g
71 (timeMid, g2) = randomBoundedIntegral g1
81 (timeMid, g2) = randomBoundedIntegral g1
@@ -110,6 +120,9 @@ instance Random Node where
110 in (Node w1 w2 w3 w4 w5 w6, g6)
120 in (Node w1 w2 w3 w4 w5 w6, g6)
111 randomR _ = random -- neglect range
121 randomR _ = random -- neglect range
123+nullNode :: Node -> Bool
124+nullNode (Node 0 0 0 0 0 0) = True
114nodeToList :: Node -> [Word8]
127nodeToList :: Node -> [Word8]
115nodeToList (Node w1 w2 w3 w4 w5 w6) = [w1, w2, w3, w4, w5, w6]
128nodeToList (Node w1 w2 w3 w4 w5 w6) = [w1, w2, w3, w4, w5, w6]