| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
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
- 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
Methods
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.
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.
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 Methods string2ID :: String -> Either TypeIDError TypeID Source # text2ID :: Text -> Either TypeIDError TypeID Source # byteString2ID :: ByteString -> Either TypeIDError TypeID Source # id2String :: TypeID -> String Source # id2Text :: TypeID -> Text Source # id2ByteString :: TypeID -> ByteString Source # | |
| (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) => IDConv (KindID prefix) Source # | Conversion between |
Defined in Data.KindID.Internal Methods 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 # | |