mmzk-typeid-0.2.0.0: A TypeID implementation for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.TypeID.Class

Contents

Description

A module with the APIs for any TypeID-ish identifier type.

It is not completed as most of the functions are still implemented individually in the Data.TypeID and Data.KindID modules.

Synopsis

Type classes

class IDType a where Source #

A type class for a TypeID-ish identifier type, which has a Text prefix and a UUID suffix.

Methods

getPrefix :: a -> Text Source #

Get the prefix of the identifier.

getUUID :: a -> UUID Source #

Get the UUID suffix of the identifier.

getTime :: a -> Word64 Source #

Get the timestamp of the identifier.

Instances

Instances details
IDType TypeID Source #

Get the prefix, UUID, and timestamp of a TypeID.

Instance details

Defined in Data.TypeID.Internal

(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) => IDType (KindID prefix) Source #

Get the prefix, UUID, and timestamp of a KindID.

Instance details

Defined in Data.KindID.Internal

Methods

getPrefix :: KindID prefix -> Text Source #

getUUID :: KindID prefix -> UUID Source #

getTime :: KindID prefix -> Word64 Source #

class IDConv a where Source #

A type class for converting between a TypeID-ish identifier type and some string representations.

Methods

string2ID :: String -> Either TypeIDError a Source #

Parse the identifier from its String representation.

text2ID :: Text -> Either TypeIDError a Source #

Parse the identifier from its string representation as a strict Text.

byteString2ID :: ByteString -> Either TypeIDError a Source #

Parse the identifier from its string representation as a lazy ByteString.

id2String :: a -> String Source #

Pretty-print the identifier to a String.

id2Text :: a -> Text Source #

Pretty-print the identifier to a strict Text.

id2ByteString :: a -> ByteString Source #

Pretty-print the identifier to a lazy ByteString.