module Data.TypeID.V4
(
TypeIDV4
, getPrefix
, getUUID
, genTypeID
, genTypeID'
, decorateTypeID
, genID
, genID'
, decorate
, checkPrefix
, checkTypeID
, checkID
, toString
, toText
, toByteString
, parseString
, parseText
, parseByteString
, parseStringM
, parseTextM
, parseByteStringM
, id2String
, id2Text
, id2ByteString
, string2ID
, text2ID
, byteString2ID
, string2IDM
, text2IDM
, byteString2IDM
) where
import Control.Monad.IO.Class
import Data.ByteString.Lazy (ByteString)
import Data.Text (Text)
import Data.TypeID.Class
import Data.TypeID.Error
import qualified Data.TypeID.Internal as TID
import Data.UUID.Types (UUID)
import Data.UUID.Versions
type TypeIDV4 = TID.TypeID' 'V4
genTypeID :: MonadIO m => Text -> m TypeIDV4
genTypeID :: forall (m :: * -> *). MonadIO m => Text -> m TypeIDV4
genTypeID = Text -> m TypeIDV4
forall (m :: * -> *). MonadIO m => Text -> m TypeIDV4
TID.genTypeIDV4
{-# INLINE genTypeID #-}
genTypeID' :: MonadIO m => Text -> m TypeIDV4
genTypeID' :: forall (m :: * -> *). MonadIO m => Text -> m TypeIDV4
genTypeID' = Text -> m TypeIDV4
forall (m :: * -> *). MonadIO m => Text -> m TypeIDV4
TID.genTypeIDV4'
{-# INLINE genTypeID' #-}
decorateTypeID :: Text -> UUID -> Either TypeIDError TypeIDV4
decorateTypeID :: Text -> UUID -> Either TypeIDError TypeIDV4
decorateTypeID = Text -> UUID -> Either TypeIDError TypeIDV4
forall (version :: UUIDVersion).
Text -> UUID -> Either TypeIDError (TypeID' version)
TID.decorateTypeID
{-# INLINE decorateTypeID #-}
checkPrefix :: Text -> Maybe TypeIDError
checkPrefix :: Text -> Maybe TypeIDError
checkPrefix = Text -> Maybe TypeIDError
TID.checkPrefix
{-# INLINE checkPrefix #-}
checkTypeID :: TypeIDV4 -> Maybe TypeIDError
checkTypeID :: TypeIDV4 -> Maybe TypeIDError
checkTypeID = TypeIDV4 -> Maybe TypeIDError
TID.checkTypeIDV4
{-# INLINE checkTypeID #-}
toString :: TypeIDV4 -> String
toString :: TypeIDV4 -> String
toString = TypeIDV4 -> String
forall (version :: UUIDVersion). TypeID' version -> String
TID.toString
{-# INLINE toString #-}
toText :: TypeIDV4 -> Text
toText :: TypeIDV4 -> Text
toText = TypeIDV4 -> Text
forall (version :: UUIDVersion). TypeID' version -> Text
TID.toText
{-# INLINE toText #-}
toByteString :: TypeIDV4 -> ByteString
toByteString :: TypeIDV4 -> ByteString
toByteString = TypeIDV4 -> ByteString
forall (version :: UUIDVersion). TypeID' version -> ByteString
TID.toByteString
{-# INLINE toByteString #-}
parseString :: String -> Either TypeIDError TypeIDV4
parseString :: String -> Either TypeIDError TypeIDV4
parseString = String -> Either TypeIDError TypeIDV4
forall (version :: UUIDVersion).
String -> Either TypeIDError (TypeID' version)
TID.parseString
{-# INLINE parseString #-}
parseText :: Text -> Either TypeIDError TypeIDV4
parseText :: Text -> Either TypeIDError TypeIDV4
parseText = Text -> Either TypeIDError TypeIDV4
forall (version :: UUIDVersion).
Text -> Either TypeIDError (TypeID' version)
TID.parseText
{-# INLINE parseText #-}
parseByteString :: ByteString -> Either TypeIDError TypeIDV4
parseByteString :: ByteString -> Either TypeIDError TypeIDV4
parseByteString = ByteString -> Either TypeIDError TypeIDV4
forall (version :: UUIDVersion).
ByteString -> Either TypeIDError (TypeID' version)
TID.parseByteString
{-# INLINE parseByteString #-}
parseStringM :: MonadIO m => String -> m TypeIDV4
parseStringM :: forall (m :: * -> *). MonadIO m => String -> m TypeIDV4
parseStringM = String -> m TypeIDV4
forall (m :: * -> *) (version :: UUIDVersion).
MonadIO m =>
String -> m (TypeID' version)
TID.parseStringM
{-# INLINE parseStringM #-}
parseTextM :: MonadIO m => Text -> m TypeIDV4
parseTextM :: forall (m :: * -> *). MonadIO m => Text -> m TypeIDV4
parseTextM = Text -> m TypeIDV4
forall (m :: * -> *) (version :: UUIDVersion).
MonadIO m =>
Text -> m (TypeID' version)
TID.parseTextM
{-# INLINE parseTextM #-}
parseByteStringM :: MonadIO m => ByteString -> m TypeIDV4
parseByteStringM :: forall (m :: * -> *). MonadIO m => ByteString -> m TypeIDV4
parseByteStringM = ByteString -> m TypeIDV4
forall (m :: * -> *) (version :: UUIDVersion).
MonadIO m =>
ByteString -> m (TypeID' version)
TID.parseByteStringM
{-# INLINE parseByteStringM #-}