module Data.KindID.V4
(
KindIDV4
, getPrefix
, getUUID
, getTime
, genKindID
, genKindID'
, decorateKindID
, genID
, genID'
, decorate
, checkKindID
, checkID
, toString
, toText
, toByteString
, parseString
, parseText
, parseByteString
, parseStringM
, parseTextM
, parseByteStringM
, id2String
, id2Text
, id2ByteString
, string2ID
, text2ID
, byteString2ID
, string2IDM
, text2IDM
, byteString2IDM
, toTypeID
, fromTypeID
) where
import Control.Monad.IO.Class
import Data.ByteString.Lazy (ByteString)
import Data.KindID.Class
import Data.KindID.Internal (KindID'(..))
import qualified Data.KindID.Internal as KID
import Data.Text (Text)
import Data.TypeID.Class
import Data.TypeID.Error
import Data.TypeID.V4 (TypeIDV4)
import Data.TypeID.V7 (TypeID)
import Data.UUID.Types.Internal (UUID)
import Data.UUID.Versions
type KindIDV4 = KID.KindID' 'V4
genKindID :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m)
=> m (KindIDV4 prefix)
genKindID :: forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
m (KindIDV4 prefix)
genKindID = forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
m (KindIDV4 prefix)
KID.genKindIDV4
{-# INLINE genKindID #-}
genKindID' :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m)
=> m (KindIDV4 prefix)
genKindID' :: forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
m (KindIDV4 prefix)
genKindID' = forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
m (KindIDV4 prefix)
KID.genKindIDV4'
{-# INLINE genKindID' #-}
decorateKindID :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> UUID -> KindIDV4 prefix
decorateKindID :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
UUID -> KindIDV4 prefix
decorateKindID = forall {k} (prefix :: k) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
UUID -> KindID' version prefix
KID.decorateKindID
{-# INLINE decorateKindID #-}
checkKindID :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> KindIDV4 prefix -> Maybe TypeIDError
checkKindID :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> Maybe TypeIDError
checkKindID = forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> Maybe TypeIDError
KID.checkKindIDV4
{-# INLINE checkKindID #-}
toString :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> KindIDV4 prefix -> String
toString :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> String
toString = forall {k} (prefix :: k) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindID' version prefix -> String
KID.toString
{-# INLINE toString #-}
toText :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> KindIDV4 prefix -> Text
toText :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> Text
toText = forall {k} (prefix :: k) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindID' version prefix -> Text
KID.toText
{-# INLINE toText #-}
toByteString :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> KindIDV4 prefix -> ByteString
toByteString :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> ByteString
toByteString = forall {k} (prefix :: k) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindID' version prefix -> ByteString
KID.toByteString
{-# INLINE toByteString #-}
parseString :: forall prefix
. (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> String -> Either TypeIDError (KindIDV4 prefix)
parseString :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
String -> Either TypeIDError (KindIDV4 prefix)
parseString = forall {k} (version :: UUIDVersion) (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
String -> Either TypeIDError (KindID' version prefix)
KID.parseString
{-# INLINE parseString #-}
parseText :: forall prefix
. (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> Text -> Either TypeIDError (KindIDV4 prefix)
parseText :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
Text -> Either TypeIDError (KindIDV4 prefix)
parseText = forall {k} (version :: UUIDVersion) (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
Text -> Either TypeIDError (KindID' version prefix)
KID.parseText
{-# INLINE parseText #-}
parseByteString :: forall prefix
. (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> ByteString -> Either TypeIDError (KindIDV4 prefix)
parseByteString :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
ByteString -> Either TypeIDError (KindIDV4 prefix)
parseByteString = forall {k} (version :: UUIDVersion) (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
ByteString -> Either TypeIDError (KindID' version prefix)
KID.parseByteString
parseStringM :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m)
=> String -> m (KindIDV4 prefix)
parseStringM :: forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
String -> m (KindIDV4 prefix)
parseStringM = forall {k} (prefix :: k) (m :: * -> *) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
String -> m (KindID' version prefix)
KID.parseStringM
{-# INLINE parseStringM #-}
parseTextM :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m)
=> Text -> m (KindIDV4 prefix)
parseTextM :: forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
Text -> m (KindIDV4 prefix)
parseTextM = forall {k} (prefix :: k) (m :: * -> *) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
Text -> m (KindID' version prefix)
KID.parseTextM
{-# INLINE parseTextM #-}
parseByteStringM :: ( ToPrefix prefix
, ValidPrefix (PrefixSymbol prefix)
, MonadIO m )
=> ByteString -> m (KindIDV4 prefix)
parseByteStringM :: forall {k} (prefix :: k) (m :: * -> *).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
ByteString -> m (KindIDV4 prefix)
parseByteStringM = forall {k} (prefix :: k) (m :: * -> *) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix), MonadIO m) =>
ByteString -> m (KindID' version prefix)
KID.parseByteStringM
{-# INLINE parseByteStringM #-}
toTypeID :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> KindIDV4 prefix -> TypeIDV4
toTypeID :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindIDV4 prefix -> TypeIDV4
toTypeID = forall {k} (prefix :: k) (version :: UUIDVersion).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
KindID' version prefix -> TypeID' version
KID.toTypeID
{-# INLINE toTypeID #-}
fromTypeID :: (ToPrefix prefix, ValidPrefix (PrefixSymbol prefix))
=> TypeIDV4 -> Maybe (KindIDV4 prefix)
fromTypeID :: forall {k} (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
TypeIDV4 -> Maybe (KindIDV4 prefix)
fromTypeID = forall {k} (version :: UUIDVersion) (prefix :: k).
(ToPrefix prefix, ValidPrefix (PrefixSymbol prefix)) =>
TypeID' version -> Maybe (KindID' version prefix)
KID.fromTypeID
{-# INLINE fromTypeID #-}