Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data BingLanguage
- data BingContext
- data BingError = BingError ByteString
- type ClientId = ByteString
- type ClientSecret = ByteString
- checkToken :: MonadIO m => BingContext -> ExceptT BingError m BingContext
- evalBing :: MonadIO m => ClientId -> ClientSecret -> BingMonad m a -> m (Either BingError a)
- execBing :: MonadIO m => BingContext -> BingMonad m a -> m (Either BingError (a, BingContext))
- getAccessToken :: MonadIO m => ByteString -> ByteString -> ExceptT BingError m BingContext
- getAccessTokenEither :: ClientId -> ClientSecret -> IO (Either BingError BingContext)
- getBingCtx :: Monad m => BingMonad m BingContext
- runBing :: BingMonad m a -> BingContext -> ExceptT BingError m a
- runExceptT :: ExceptT e m a -> m (Either e a)
- translate :: ClientId -> ClientSecret -> Text -> BingLanguage -> BingLanguage -> IO (Either BingError Text)
- translateM :: MonadIO m => Text -> BingLanguage -> BingLanguage -> BingMonad m Text
Documentation
data BingLanguage Source
The languages available for Microsoft Translatorj
type ClientId = ByteString Source
type ClientSecret = ByteString Source
checkToken :: MonadIO m => BingContext -> ExceptT BingError m BingContext Source
Check if the access token of the running BingAction is still valid. If the token has expired, renews the token automatically
evalBing :: MonadIO m => ClientId -> ClientSecret -> BingMonad m a -> m (Either BingError a) Source
Helper function that evaluates a BingMonad action. It simply requests and access token and uses the token for evaluation.
execBing :: MonadIO m => BingContext -> BingMonad m a -> m (Either BingError (a, BingContext)) Source
getAccessToken :: MonadIO m => ByteString -> ByteString -> ExceptT BingError m BingContext Source
Request a new access token from Azure using the specified client id and client secret
getBingCtx :: Monad m => BingMonad m BingContext Source
runBing :: BingMonad m a -> BingContext -> ExceptT BingError m a Source
runExceptT :: ExceptT e m a -> m (Either e a)
The inverse of ExceptT
.
translate :: ClientId -> ClientSecret -> Text -> BingLanguage -> BingLanguage -> IO (Either BingError Text) Source
Toplevel wrapper that translates a text. It is only recommended if translation is invoked less often than every 10 minutes since it always requests a new access token. For better performance use translateM, runBing and getAccessToken
translateM :: MonadIO m => Text -> BingLanguage -> BingLanguage -> BingMonad m Text Source
Action that translates text inside a BingMonad context.