-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interface for Microsoft Translator -- -- A simple library to use Microsoft Translator 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 here. @package MicrosoftTranslator @version 0.1.0.1 module Language.Bing -- | The languages available for Microsoft Translatorj data BingLanguage English :: BingLanguage German :: BingLanguage Norwegian :: BingLanguage Spanish :: BingLanguage data BingContext 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 :: MonadIO m => BingContext -> ExceptT BingError m BingContext -- | Helper function that evaluates a BingMonad action. It simply requests -- and access token and uses the token for evaluation. evalBing :: MonadIO m => ClientId -> ClientSecret -> BingMonad m a -> m (Either BingError a) execBing :: MonadIO m => BingContext -> BingMonad m a -> m (Either BingError (a, BingContext)) -- | Request a new access token from Azure using the specified client id -- and client secret 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 -- | The inverse of ExceptT. runExceptT :: ExceptT e m a -> m (Either e 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 :: MonadIO m => Text -> BingLanguage -> BingLanguage -> BingMonad m 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 m, Control.Monad.IO.Class.MonadIO m) => GHC.Base.Monad (Language.Bing.BingMonad m) instance (GHC.Base.Monad m, Control.Monad.IO.Class.MonadIO m) => GHC.Base.Functor (Language.Bing.BingMonad m) instance (GHC.Base.Monad m, Control.Monad.IO.Class.MonadIO m) => GHC.Base.Applicative (Language.Bing.BingMonad m) instance Control.Monad.Trans.Class.MonadTrans Language.Bing.BingMonad instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Language.Bing.BingMonad m) instance Data.Aeson.Types.Class.FromJSON Language.Bing.AccessToken instance GHC.Exception.Exception Language.Bing.BingError