-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Interface for Microsoft Translator
--
-- A simple library to use Microsoft Translator
-- (https://www.microsoft.com/en-us/translator/default.aspx) in
-- Haskell. It provides an easy to use interface to the free translation
-- service from Microsoft so one can easily add language translation to a
-- Haskell program as long as there is internet connection available. The
-- easiest way to use the program is via the toplevel translate function:
-- > translate :: ClientId -> ClientSecret -> Text ->
-- BingLanguage -> BingLanguage -> IO (Either BingError Text) To
-- use this library one must have an account for Microsoft Translator in
-- the Azure Data Market. More information about this package available
-- at:
-- (https://github.com/netogallo/Microsoft-Translator-Haskell).
@package MicrosoftTranslator
@version 0.1.0.0
module Language.Bing
-- | The languages available for Microsoft Translatorj
data BingLanguage
English :: BingLanguage
German :: BingLanguage
Norwegian :: BingLanguage
Spanish :: BingLanguage
data BingError
BingError :: ByteString -> BingError
type ClientId = ByteString
type ClientSecret = ByteString
-- | Check if the access token of the running BingAction is still valid. If
-- the token has expired, renews the token automatically
checkToken :: BingContext -> ExceptT BingError IO BingContext
-- | Helper function that evaluates a BingMonad action. It simply requests
-- and access token and uses the token for evaluation.
evalBing :: ClientId -> ClientSecret -> BingMonad a -> IO (Either BingError a)
-- | Request a new access token from Azure using the specified client id
-- and client secret
getAccessToken :: ByteString -> ByteString -> ExceptT BingError IO BingContext
runBing :: BingMonad a -> BingContext -> ExceptT BingError IO a
-- | 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
translate :: ClientId -> ClientSecret -> Text -> BingLanguage -> BingLanguage -> IO (Either BingError Text)
-- | Action that translates text inside a BingMonad context.
translateM :: Text -> BingLanguage -> BingLanguage -> BingMonad Text
instance GHC.Show.Show Language.Bing.BingContext
instance GHC.Show.Show Language.Bing.AccessToken
instance GHC.Show.Show Language.Bing.BingError
instance GHC.Base.Monad Language.Bing.BingMonad
instance GHC.Base.Functor Language.Bing.BingMonad
instance GHC.Base.Applicative Language.Bing.BingMonad
instance Data.Aeson.Types.Class.FromJSON Language.Bing.AccessToken
instance GHC.Exception.Exception Language.Bing.BingError