Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- class IDType a where
- class IDConv a where
- string2ID :: String -> Either TypeIDError a
- text2ID :: Text -> Either TypeIDError a
- byteString2ID :: ByteString -> Either TypeIDError a
- id2String :: a -> String
- id2Text :: a -> Text
- id2ByteString :: a -> ByteString
Type classes
getPrefix :: a -> Text Source #
Get the prefix of the identifier.
Get the UUID suffix of the identifier.
getTime :: a -> Word64 Source #
Get the timestamp of the identifier.
A type class for converting between a TypeID-ish identifier type and some string representations.
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
.
Pretty-print the identifier to a strict Text
.
id2ByteString :: a -> ByteString Source #
Pretty-print the identifier to a lazy ByteString
.
Instances
IDConv TypeID Source # | Conversion between |
Defined in Data.TypeID.Internal | |
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) => IDConv (KindID prefix) Source # | Conversion between |
Defined in Data.KindID.Internal string2ID :: String -> Either TypeIDError (KindID prefix) Source # text2ID :: Text -> Either TypeIDError (KindID prefix) Source # byteString2ID :: ByteString -> Either TypeIDError (KindID prefix) Source # id2String :: KindID prefix -> String Source # id2Text :: KindID prefix -> Text Source # id2ByteString :: KindID prefix -> ByteString Source # |