localize-0.2.0.0: GNU Gettext-based messages localization library

Safe HaskellNone
LanguageHaskell2010

Text.Localize.State

Contents

Description

This module offers a simple implementation of Localized class via StateT transformer. This implementation is usable if you have nothing against adding yet another transformer to your already complicated monadic stack. Otherwise, it may be simpler for you to add necessary fields to one of StateTs or ReaderTs in your stack.

Synopsis

Data types

newtype LocalizeT m a Source #

Localization monad transformer

Constructors

LocalizeT 

Fields

Instances

Monad m => MonadState LocState (LocalizeT m) Source # 

Methods

get :: LocalizeT m LocState #

put :: LocState -> LocalizeT m () #

state :: (LocState -> (a, LocState)) -> LocalizeT m a #

Monad m => Monad (LocalizeT m) Source # 

Methods

(>>=) :: LocalizeT m a -> (a -> LocalizeT m b) -> LocalizeT m b #

(>>) :: LocalizeT m a -> LocalizeT m b -> LocalizeT m b #

return :: a -> LocalizeT m a #

fail :: String -> LocalizeT m a #

Functor m => Functor (LocalizeT m) Source # 

Methods

fmap :: (a -> b) -> LocalizeT m a -> LocalizeT m b #

(<$) :: a -> LocalizeT m b -> LocalizeT m a #

Monad m => Applicative (LocalizeT m) Source # 

Methods

pure :: a -> LocalizeT m a #

(<*>) :: LocalizeT m (a -> b) -> LocalizeT m a -> LocalizeT m b #

(*>) :: LocalizeT m a -> LocalizeT m b -> LocalizeT m b #

(<*) :: LocalizeT m a -> LocalizeT m b -> LocalizeT m a #

MonadIO m => MonadIO (LocalizeT m) Source # 

Methods

liftIO :: IO a -> LocalizeT m a #

Monad m => Localized (LocalizeT m) Source # 

Functions

runLocalizeT :: Monad m => LocalizeT m a -> LocState -> m a Source #

Run a computation inside LocalizeT.

setLanguage :: Monad m => LanguageId -> LocalizeT m () Source #

Set current language

withLanguage :: Monad m => LanguageId -> LocalizeT m a -> LocalizeT m a Source #

Execute some actions with specified language.

setContext :: Monad m => Maybe Context -> LocalizeT m () Source #

Set current context.

withContext :: Monad m => Maybe Context -> LocalizeT m a -> LocalizeT m a Source #

Execute some actions within specific context.