-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Type definitions for Universally Unique Identifiers
--   
--   This library contains type definitions for Universally Unique
--   Identifiers and basic conversion functions. See
--   <a>http://en.wikipedia.org/wiki/UUID</a> for the general idea.
@package uuid-types
@version 1.0.3


-- | This library is useful for comparing, parsing and printing Universally
--   Unique Identifiers. See <a>http://en.wikipedia.org/wiki/UUID</a> for
--   the general idea. See <a>http://tools.ietf.org/html/rfc4122</a> for
--   the specification.
module Data.UUID.Types

-- | The UUID type. A <a>Random</a> instance is provided which produces
--   version 4 UUIDs as specified in RFC 4122. The <a>Storable</a> and
--   <a>Binary</a> instances are compatible with RFC 4122, storing the
--   fields in network order as 16 bytes.
data UUID

-- | Convert a UUID into a hypenated string using lower-case letters.
--   Example:
--   
--   <pre>
--   toString &lt;$&gt; fromString "550e8400-e29b-41d4-a716-446655440000"
--   </pre>
toString :: UUID -> String

-- | If the passed in <a>String</a> can be parsed as a <a>UUID</a>, it will
--   be. The hyphens may not be omitted. Example:
--   
--   <pre>
--   fromString "c2cc10e1-57d6-4b6f-9899-38d972112d8c"
--   </pre>
--   
--   Hex digits may be upper or lower-case.
fromString :: String -> Maybe UUID

-- | Convert a UUID into a hyphentated string using lower-case letters.
toText :: UUID -> Text

-- | If the passed in <a>Text</a> can be parsed as an ASCII representation
--   of a <a>UUID</a>, it will be. The hyphens may not be omitted.
fromText :: Text -> Maybe UUID

-- | Convert a UUID into a hyphentated string using lower-case letters,
--   packed as ASCII bytes into <a>ByteString</a>.
--   
--   This should be equivalent to <a>toString</a> with <a>pack</a>.
toASCIIBytes :: UUID -> ByteString

-- | If the passed in <a>ByteString</a> can be parsed as an ASCII
--   representation of a <a>UUID</a>, it will be. The hyphens may not be
--   omitted.
--   
--   This should be equivalent to <a>fromString</a> with <a>unpack</a>.
fromASCIIBytes :: ByteString -> Maybe UUID

-- | Similar to <a>toASCIIBytes</a> except we produce a lazy
--   <a>ByteString</a>.
toLazyASCIIBytes :: UUID -> ByteString

-- | Similar to <a>fromASCIIBytes</a> except parses from a lazy
--   <a>ByteString</a>.
fromLazyASCIIBytes :: ByteString -> Maybe UUID

-- | Encode a UUID into a <tt>ByteString</tt> in network order.
toByteString :: UUID -> ByteString

-- | Extract a UUID from a <tt>ByteString</tt> in network byte order. The
--   argument must be 16 bytes long, otherwise <a>Nothing</a> is returned.
fromByteString :: ByteString -> Maybe UUID

-- | Covert a <a>UUID</a> into a sequence of <a>Word32</a> values. Useful
--   for when you need to serialize a UUID and neither <a>Storable</a> nor
--   <a>Binary</a> are appropriate. Introduced in version 1.2.2.
toWords :: UUID -> (Word32, Word32, Word32, Word32)

-- | Create a <a>UUID</a> from a sequence of <a>Word32</a>. The opposite of
--   <a>toWords</a>. Useful when you need a total function for constructing
--   <a>UUID</a> values. Introduced in version 1.2.2.
fromWords :: Word32 -> Word32 -> Word32 -> Word32 -> UUID

-- | Returns true if the passed-in UUID is the <a>nil</a> UUID.
null :: UUID -> Bool

-- | The nil UUID, as defined in RFC 4122. It is a UUID of all zeros.
--   <tt><a>null</a> u</tt> iff <tt><tt>u</tt> == <a>nil</a></tt>.
nil :: UUID
