MicrosoftTranslator-0.1.0.0: Interface for Microsoft Translator

Safe HaskellNone
LanguageHaskell2010

Language.Bing

Synopsis

Documentation

data BingLanguage Source

The languages available for Microsoft Translatorj

Constructors

English 
German 
Norwegian 
Spanish 

checkToken :: BingContext -> ExceptT BingError IO BingContext Source

Check if the access token of the running BingAction is still valid. If the token has expired, renews the token automatically

evalBing :: ClientId -> ClientSecret -> BingMonad a -> IO (Either BingError a) Source

Helper function that evaluates a BingMonad action. It simply requests and access token and uses the token for evaluation.

getAccessToken :: ByteString -> ByteString -> ExceptT BingError IO BingContext Source

Request a new access token from Azure using the specified client id and client secret

runBing :: BingMonad a -> BingContext -> ExceptT BingError IO a Source

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 :: Text -> BingLanguage -> BingLanguage -> BingMonad Text Source

Action that translates text inside a BingMonad context.