-- | Globally Unique IDentifiers.moduleData.CQRS.GUID(GUID,fromByteString,newGUID,nil,toByteString)whereimportData.ByteString(ByteString)importqualifiedData.ByteStringasBimportData.ByteString.Char8()importData.Typeable(Typeable)importData.Word(Word8)importSystem.Random(randomRIO)-- | A GUID for values of type 'a'.newtypeGUIDa=GUIDByteStringderiving(Show,Typeable,Eq)-- | The "nil" GUID. This is used for the root-- aggregate root which all other aggregate roots-- can be reached from.nil::GUIDanil=GUID$B.pack$replicate320-- | Get a random byte.randomWord8::IOWord8randomWord8=fmapfromInteger$randomRIO(0,255)-- | Create a new random GUID.newGUID::IO(GUIDa)newGUID=douuid<-sequence$replicate32randomWord8return$GUID$B.packuuid-- | Convert GUID to ByteString.toByteString::GUIDa->ByteStringtoByteString(GUIDs)=s-- | Convert ByteString to GUID.fromByteString::ByteString->GUIDafromByteStrings=GUIDs