@@ -1,4 +1,4 @@
1−{-# LANGUAGE DeriveDataTypeable #-}
1+{-# LANGUAGE DeriveDataTypeable, CPP #-}
22
33-- |
44-- Module : Data.UUID
@@ -42,17 +42,23 @@ import System.Random
4242
4343import Text.Printf
4444
45+#ifndef STRICT
46+#define SLOT(x) x
47+#else
48+#define SLOT(x) {-# UNPACK #-} !x
49+#endif
50+
4551-- |The UUID type. A 'Random' instance is provided which produces
4652-- version 3 UUIDs as specified in RFC 4122. The 'Storable' and
4753-- 'Binary' instances are compatable with RFC 4122. The 'Binary'
4854-- instance serializes to network byte order.
4955data UUID = UUID
50− {uuid_timeLow :: {-# UNPACK #-} !Word32
51− ,uuid_timeMid :: {-# UNPACK #-} !Word16
52− ,uuid_timeHigh :: {-# UNPACK #-} !Word16 -- includes version number
53− ,uuid_clockSeqHi :: {-# UNPACK #-} !Word8 -- includes reserved field
54− ,uuid_clokcSeqLow :: {-# UNPACK #-} !Word8
55− ,uuid_node :: {-# UNPACK #-} !Node
56+ {uuid_timeLow :: SLOT(Word32)
57+ ,uuid_timeMid :: SLOT(Word16)
58+ ,uuid_timeHigh :: SLOT(Word16) -- includes version number
59+ ,uuid_clockSeqHi :: SLOT(Word8) -- includes reserved field
60+ ,uuid_clokcSeqLow :: SLOT(Word8)
61+ ,uuid_node :: SLOT(Node)
5662 } deriving (Eq, Ord, Typeable)
5763
5864instance Random UUID where
@@ -81,12 +87,12 @@ reserved :: Word8
8187reserved = bit 7
8288
8389data Node = Node
84− {-# UNPACK #-} !Word8
85− {-# UNPACK #-} !Word8
86− {-# UNPACK #-} !Word8
87− {-# UNPACK #-} !Word8
88− {-# UNPACK #-} !Word8
89− {-# UNPACK #-} !Word8
90+ SLOT(Word8)
91+ SLOT(Word8)
92+ SLOT(Word8)
93+ SLOT(Word8)
94+ SLOT(Word8)
95+ SLOT(Word8)
9096 deriving (Eq, Ord, Typeable)
9197
9298instance Random Node where