Copyright | (c) 20082012 Antoine Latter |
---|---|
License | BSD-style |
Maintainer | aslatter@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This library is useful for comparing, parsing and printing Universally Unique Identifiers. See http://en.wikipedia.org/wiki/UUID for the general idea. See http://tools.ietf.org/html/rfc4122 for the specification.
- Random UUIDs may be generated using
nextRandom
or your favorite instance ofRandom
. - We have an implementation of generating a UUID from the hardware MAC address and current system time in Data.UUID.V1.
- For name-based generation of UUIDs using SHA-1 hashing see Data.UUID.V5.
- data UUID :: *
- toString :: UUID -> String
- fromString :: String -> Maybe UUID
- toText :: UUID -> Text
- fromText :: Text -> Maybe UUID
- toASCIIBytes :: UUID -> ByteString
- fromASCIIBytes :: ByteString -> Maybe UUID
- toLazyASCIIBytes :: UUID -> ByteString
- fromLazyASCIIBytes :: ByteString -> Maybe UUID
- toByteString :: UUID -> ByteString
- fromByteString :: ByteString -> Maybe UUID
- toWords :: UUID -> (Word32, Word32, Word32, Word32)
- fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUID
- null :: UUID -> Bool
- nil :: UUID
Documentation
Convert a UUID into a hypenated string using lower-case letters. Example:
toString <$> fromString "550e8400-e29b-41d4-a716-446655440000"
fromString :: String -> Maybe UUID #
toASCIIBytes :: UUID -> ByteString #
Convert a UUID into a hyphentated string using lower-case letters, packed
as ASCII bytes into ByteString
.
fromASCIIBytes :: ByteString -> Maybe UUID #
If the passed in ByteString
can be parsed as an ASCII representation of
a UUID
, it will be. The hyphens may not be omitted.
This should be equivalent to fromString
with unpack
.
toLazyASCIIBytes :: UUID -> ByteString #
Similar to toASCIIBytes
except we produce a lazy ByteString
.
fromLazyASCIIBytes :: ByteString -> Maybe UUID #
Similar to fromASCIIBytes
except parses from a lazy ByteString
.
toByteString :: UUID -> ByteString #
Encode a UUID into a ByteString
in network order.
fromByteString :: ByteString -> Maybe UUID #
Extract a UUID from a ByteString
in network byte order.
The argument must be 16 bytes long, otherwise Nothing
is returned.