Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 StateT
s or ReaderT
s in your stack.
- data LocState = LocState {}
- newtype LocalizeT m a = LocalizeT {
- unLocalizeT :: StateT LocState m a
- runLocalizeT :: Monad m => LocalizeT m a -> LocState -> m a
- setLanguage :: Monad m => LanguageId -> LocalizeT m ()
- withLanguage :: Monad m => LanguageId -> LocalizeT m a -> LocalizeT m a
- setContext :: Monad m => Maybe Context -> LocalizeT m ()
- withContext :: Monad m => Maybe Context -> LocalizeT m a -> LocalizeT m a
Data types
Localization state
newtype LocalizeT m a Source #
Localization monad transformer
LocalizeT | |
|
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.