@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveDataTypeable #-}
1+{-# LANGUAGE DeriveDataTypeable, CPP #-}
4-- Module : Data.UUID
4-- Module : Data.UUID
@@ -42,17 +42,23 @@ import System.Random
43import Text.Printf
43import Text.Printf
48+#define SLOT(x) {-# UNPACK #-} !x
45-- |The UUID type. A 'Random' instance is provided which produces
51-- |The UUID type. A 'Random' instance is provided which produces
46-- version 3 UUIDs as specified in RFC 4122. The 'Storable' and
52-- version 3 UUIDs as specified in RFC 4122. The 'Storable' and
47-- 'Binary' instances are compatable with RFC 4122. The 'Binary'
53-- 'Binary' instances are compatable with RFC 4122. The 'Binary'
48-- instance serializes to network byte order.
54-- instance serializes to network byte order.
49data UUID = UUID
55data UUID = UUID
50− {uuid_timeLow :: {-# UNPACK #-} !Word32
56+ {uuid_timeLow :: SLOT(Word32)
51− ,uuid_timeMid :: {-# UNPACK #-} !Word16
57+ ,uuid_timeMid :: SLOT(Word16)
52− ,uuid_timeHigh :: {-# UNPACK #-} !Word16 -- includes version number
58+ ,uuid_timeHigh :: SLOT(Word16) -- includes version number
53− ,uuid_clockSeqHi :: {-# UNPACK #-} !Word8 -- includes reserved field
59+ ,uuid_clockSeqHi :: SLOT(Word8) -- includes reserved field
54− ,uuid_clokcSeqLow :: {-# UNPACK #-} !Word8
60+ ,uuid_clokcSeqLow :: SLOT(Word8)
55− ,uuid_node :: {-# UNPACK #-} !Node
61+ ,uuid_node :: SLOT(Node)
56 } deriving (Eq, Ord, Typeable)
62 } deriving (Eq, Ord, Typeable)
58instance Random UUID where
64instance Random UUID where
@@ -81,12 +87,12 @@ reserved :: Word8
81reserved = bit 7
87reserved = bit 7
83data Node = Node
89data Node = Node
84− {-# UNPACK #-} !Word8
90+ SLOT(Word8)
85− {-# UNPACK #-} !Word8
91+ SLOT(Word8)
86− {-# UNPACK #-} !Word8
92+ SLOT(Word8)
87− {-# UNPACK #-} !Word8
93+ SLOT(Word8)
88− {-# UNPACK #-} !Word8
94+ SLOT(Word8)
89− {-# UNPACK #-} !Word8
95+ SLOT(Word8)
90 deriving (Eq, Ord, Typeable)
96 deriving (Eq, Ord, Typeable)
92instance Random Node where
98instance Random Node where