Shorter and more readable alias for flip runReader.
usingReader 42 $ asks (+5)47
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulerelude-1.2.0.0Haskell2010
SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
Monad transformers utilities.
Shorter and more readable alias for flip runReader.
usingReader 42 $ asks (+5)47
Shorter and more readable alias for flip runReaderT.
usingReaderT 42 $ asks (+5)47
This function helps with optimizing performance when working with the ReaderT transformer. If you have code like below, that is called in a loop
step :: Instruction -> ReaderT Config IO Result
step instruction = case instruction of
Add -> do stuff ...
Del -> do stuff ...
you can improve performance of your Haskell applications by using etaReaderT in the following way:
step :: Instruction -> ReaderT Config IO Result
step instruction = etaReaderT $ case instruction of
Add -> do stuff ...
Del -> do stuff ...
For a detailed explanation, refer to the following blog post:
Alias for flip evalState. It's not shorter but sometimes
more readable. Done by analogy with using* functions family.
Alias for flip evalStateT. It's not shorter but sometimes
more readable. Done by analogy with using* functions family.
Alias for flip execState. It's not shorter but sometimes
more readable. Done by analogy with using* functions family.
Alias for flip execStateT. It's not shorter but sometimes
more readable. Done by analogy with using* functions family.
Shorter and more readable alias for flip runState.
Shorter and more readable alias for flip runStateT.
usingStateT 0 $ put 42 >> pure False(False,42)