-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A small library that lets you generate YouTube-looking IDs from numbers.
--
-- Sqids (pronounced "squids") is an open-source library that lets you
-- generate YouTube-looking IDs from numbers. These IDs are short, can be
-- generated from a custom alphabet and are guaranteed to be
-- collision-free. For more info, see
-- https://github.com/sqids/sqids-haskell#readme and the official
-- Sqids home page https://sqids.org.
@package sqids
@version 0.2.2.0
module Web.Sqids.Blocklist
defaultBlocklist :: [Text]
module Web.Sqids.Utils.Internal
letterCount :: Text -> Int
charSet :: Text -> Set Char
swapChars :: Int -> Int -> Text -> Text
replaceCharAtIndex :: Int -> Char -> Text -> Text
wordsNoLongerThan :: Int -> [Text] -> [Text]
unsafeIndex :: Char -> Text -> Int
unsafeUncons :: Text -> (Char, Text)
containsMultibyteChars :: Text -> Bool
module Web.Sqids.Internal
-- | Sqids spec. version
sqidsVersion :: String
-- | Options that can be passed to runSqids or runSqidsT.
data SqidsOptions
SqidsOptions :: !Text -> !Int -> ![Text] -> SqidsOptions
-- | The set of characters to use for encoding and decoding IDs.
[alphabet] :: SqidsOptions -> !Text
-- | The minimum allowed length of IDs.
[minLength] :: SqidsOptions -> !Int
-- | A list of words that must never appear in IDs.
[blocklist] :: SqidsOptions -> ![Text]
data SqidsError
-- | One or more numbers in the list passed to encode are
-- negative. Only non-negative integers can be used as input.
SqidsNegativeNumberInInput :: SqidsError
-- | Maximum allowed attemps was reached during encoding
SqidsMaxEncodingAttempts :: SqidsError
-- | The alphabet cannot contain multi-byte characters.
SqidsAlphabetContainsMultibyteCharacters :: SqidsError
-- | The alphabet must be at least 3 characters long.
SqidsAlphabetTooShort :: SqidsError
-- | The provided alphabet contains duplicate characters. E.g., "abcdefgg"
-- is not a valid alphabet.
SqidsAlphabetRepeatedCharacters :: SqidsError
-- | The given minLength value is not within the valid range.
SqidsInvalidMinLength :: SqidsError
data SqidsContext s
SqidsContext :: !Text -> !Int -> ![Text] -> SqidsContext s
[sqidsAlphabet] :: SqidsContext s -> !Text
[sqidsMinLength] :: SqidsContext s -> !Int
[sqidsBlocklist] :: SqidsContext s -> ![Text]
emptySqidsContext :: SqidsContext s
-- | Default options
defaultSqidsOptions :: SqidsOptions
type SqidsStack s m = ReaderT (SqidsContext s) (ExceptT SqidsError m)
class (Monad m) => MonadSqids s m | m -> s
-- | Encode a list of integers into an ID
sqidsEncode :: MonadSqids s m => [s] -> m Text
sqidsDecode :: MonadSqids s m => Text -> m [s]
-- | Sqids constructor
sqidsContext :: (MonadSqids s m, MonadError SqidsError m) => SqidsOptions -> m (SqidsContext s)
-- | Sqids monad transformer
newtype SqidsT s m a
SqidsT :: SqidsStack s m a -> SqidsT s m a
[unwrapSqidsT] :: SqidsT s m a -> SqidsStack s m a
-- | Sqids monad
type Sqids s = SqidsT s Identity
-- | Evaluate a SqidsT computation with the given options.
runSqidsT :: (Integral s, Monad m) => SqidsOptions -> SqidsT s m a -> m (Either SqidsError a)
-- | Evaluate a SqidsT computation with the default options. This is
-- a short form for `runSqidsT defaultSqidsOptions`.
sqidsT :: (Integral s, Monad m) => SqidsT s m a -> m (Either SqidsError a)
-- | Evaluate a Sqids computation with the given options.
runSqids :: Integral s => SqidsOptions -> Sqids s a -> Either SqidsError a
-- | Evaluate a Sqids computation with the default options. This is
-- a short form for `runSqids defaultSqidsOptions`.
sqids :: Integral s => Sqids s a -> Either SqidsError a
filteredBlocklist :: Text -> [Text] -> [Text]
rearrangeAlphabet :: Integral a => Int -> Text -> [a] -> Text
encodeNumbers :: (Integral s, MonadSqids s m, MonadError SqidsError m, MonadReader (SqidsContext s) m) => [s] -> Int -> m Text
decodeWithAlphabet :: Integral a => Text -> Text -> [a]
decodeStep :: Integral a => (Text, Text) -> Maybe (a, (Text, Text))
shuffle :: Text -> Text
toId :: Integral a => a -> Text -> Text
toNumber :: Integral a => Text -> Text -> a
isBlockedId :: [Text] -> Text -> Bool
instance GHC.Classes.Ord Web.Sqids.Internal.SqidsOptions
instance GHC.Classes.Eq Web.Sqids.Internal.SqidsOptions
instance GHC.Show.Show Web.Sqids.Internal.SqidsOptions
instance GHC.Classes.Ord (Web.Sqids.Internal.SqidsContext s)
instance GHC.Classes.Eq (Web.Sqids.Internal.SqidsContext s)
instance GHC.Show.Show (Web.Sqids.Internal.SqidsContext s)
instance GHC.Classes.Ord Web.Sqids.Internal.SqidsError
instance GHC.Classes.Eq Web.Sqids.Internal.SqidsError
instance GHC.Read.Read Web.Sqids.Internal.SqidsError
instance GHC.Show.Show Web.Sqids.Internal.SqidsError
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Web.Sqids.Internal.SqidsT s m)
instance GHC.Base.Monad m => Control.Monad.Error.Class.MonadError Web.Sqids.Internal.SqidsError (Web.Sqids.Internal.SqidsT s m)
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader (Web.Sqids.Internal.SqidsContext s) (Web.Sqids.Internal.SqidsT s m)
instance GHC.Base.Monad m => GHC.Base.Monad (Web.Sqids.Internal.SqidsT s m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Web.Sqids.Internal.SqidsT s m)
instance GHC.Base.Functor m => GHC.Base.Functor (Web.Sqids.Internal.SqidsT s m)
instance Control.Monad.Trans.Class.MonadTrans (Web.Sqids.Internal.SqidsT s)
instance (GHC.Real.Integral s, GHC.Base.Monad m) => Web.Sqids.Internal.MonadSqids s (Web.Sqids.Internal.SqidsT s m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.State.Strict.StateT s m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Except.ExceptT e m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Reader.ReaderT r m)
instance (Web.Sqids.Internal.MonadSqids s m, GHC.Base.Monoid w) => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Maybe.MaybeT m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Cont.ContT r m)
instance Web.Sqids.Internal.MonadSqids s m => Web.Sqids.Internal.MonadSqids s (Control.Monad.Trans.Select.SelectT r m)
module Web.Sqids.Integer
-- | Sqids spec. version
sqidsVersion :: String
-- | Default options
defaultSqidsOptions :: SqidsOptions
-- | Options that can be passed to runSqids or runSqidsT.
data SqidsOptions
SqidsOptions :: !Text -> !Int -> ![Text] -> SqidsOptions
-- | The set of characters to use for encoding and decoding IDs.
[alphabet] :: SqidsOptions -> !Text
-- | The minimum allowed length of IDs.
[minLength] :: SqidsOptions -> !Int
-- | A list of words that must never appear in IDs.
[blocklist] :: SqidsOptions -> ![Text]
data SqidsError
-- | One or more numbers in the list passed to encode are
-- negative. Only non-negative integers can be used as input.
SqidsNegativeNumberInInput :: SqidsError
-- | Maximum allowed attemps was reached during encoding
SqidsMaxEncodingAttempts :: SqidsError
-- | The alphabet cannot contain multi-byte characters.
SqidsAlphabetContainsMultibyteCharacters :: SqidsError
-- | The alphabet must be at least 3 characters long.
SqidsAlphabetTooShort :: SqidsError
-- | The provided alphabet contains duplicate characters. E.g., "abcdefgg"
-- is not a valid alphabet.
SqidsAlphabetRepeatedCharacters :: SqidsError
-- | The given minLength value is not within the valid range.
SqidsInvalidMinLength :: SqidsError
class (Monad m) => MonadSqids s m | m -> s
-- | Sqids constructor
sqidsContext :: (MonadSqids s m, MonadError SqidsError m) => SqidsOptions -> m (SqidsContext s)
-- | Sqids monad transformer
data SqidsT s m a
-- | Evaluate a SqidsT computation with the given options.
runSqidsT :: (Integral s, Monad m) => SqidsOptions -> SqidsT s m a -> m (Either SqidsError a)
-- | Evaluate a SqidsT computation with the default options. This is
-- a short form for `runSqidsT defaultSqidsOptions`.
sqidsT :: (Integral s, Monad m) => SqidsT s m a -> m (Either SqidsError a)
-- | Sqids monad
type Sqids s = SqidsT s Identity
-- | Evaluate a Sqids computation with the given options.
runSqids :: Integral s => SqidsOptions -> Sqids s a -> Either SqidsError a
-- | Evaluate a Sqids computation with the default options. This is
-- a short form for `runSqids defaultSqidsOptions`.
sqids :: Integral s => Sqids s a -> Either SqidsError a
encode :: MonadSqids Integer m => [Integer] -> m Text
decode :: MonadSqids Integer m => Text -> m [Integer]
module Web.Sqids
-- | Sqids spec. version
sqidsVersion :: String
-- | Default options
defaultSqidsOptions :: SqidsOptions
-- | Options that can be passed to runSqids or runSqidsT.
data SqidsOptions
SqidsOptions :: !Text -> !Int -> ![Text] -> SqidsOptions
-- | The set of characters to use for encoding and decoding IDs.
[alphabet] :: SqidsOptions -> !Text
-- | The minimum allowed length of IDs.
[minLength] :: SqidsOptions -> !Int
-- | A list of words that must never appear in IDs.
[blocklist] :: SqidsOptions -> ![Text]
data SqidsError
-- | One or more numbers in the list passed to encode are
-- negative. Only non-negative integers can be used as input.
SqidsNegativeNumberInInput :: SqidsError
-- | Maximum allowed attemps was reached during encoding
SqidsMaxEncodingAttempts :: SqidsError
-- | The alphabet cannot contain multi-byte characters.
SqidsAlphabetContainsMultibyteCharacters :: SqidsError
-- | The alphabet must be at least 3 characters long.
SqidsAlphabetTooShort :: SqidsError
-- | The provided alphabet contains duplicate characters. E.g., "abcdefgg"
-- is not a valid alphabet.
SqidsAlphabetRepeatedCharacters :: SqidsError
-- | The given minLength value is not within the valid range.
SqidsInvalidMinLength :: SqidsError
class (Monad m) => MonadSqids s m | m -> s
-- | Sqids constructor
sqidsContext :: (MonadSqids s m, MonadError SqidsError m) => SqidsOptions -> m (SqidsContext s)
-- | Sqids monad transformer
data SqidsT s m a
-- | Evaluate a SqidsT computation with the given options.
runSqidsT :: (Integral s, Monad m) => SqidsOptions -> SqidsT s m a -> m (Either SqidsError a)
-- | Evaluate a SqidsT computation with the default options. This is
-- a short form for `runSqidsT defaultSqidsOptions`.
sqidsT :: (Integral s, Monad m) => SqidsT s m a -> m (Either SqidsError a)
-- | Sqids monad
type Sqids s = SqidsT s Identity
-- | Evaluate a Sqids computation with the given options.
runSqids :: Integral s => SqidsOptions -> Sqids s a -> Either SqidsError a
-- | Evaluate a Sqids computation with the default options. This is
-- a short form for `runSqids defaultSqidsOptions`.
sqids :: Integral s => Sqids s a -> Either SqidsError a
encode :: MonadSqids Int m => [Int] -> m Text
decode :: MonadSqids Int m => Text -> m [Int]