Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal types to the library.
- data Env config = Env {
- envConfig :: !config
- envReExec :: !Bool
- envLogOptions :: !LogOptions
- envTerminal :: !Bool
- envSticky :: !Sticky
- class HasTerminal env where
- class HasReExec env where
- newtype Sticky = Sticky {}
- class HasSticky env where
- data LogOptions = LogOptions {}
- class HasLogOptions env where
- view :: MonadReader s m => Getting a s a -> m a
Documentation
Monadic environment.
Env | |
|
HasEnvConfig config => HasEnvConfig (Env config) Source # | |
HasBuildConfig config => HasBuildConfig (Env config) Source # | |
HasConfig config => HasConfig (Env config) Source # | |
HasGHCVariant config => HasGHCVariant (Env config) Source # | |
HasPlatform config => HasPlatform (Env config) Source # | |
HasLogOptions (Env config) Source # | |
HasSticky (Env config) Source # | |
HasReExec (Env config) Source # | |
HasTerminal (Env config) Source # | |
Monad m => MonadReader (Env config) (StackT config m) # | |
class HasTerminal env where Source #
HasTerminal (Env config) Source # | |
data LogOptions Source #
LogOptions | |
|
class HasLogOptions env where Source #
logOptionsL :: Lens' env LogOptions Source #
HasLogOptions (Env config) Source # | |
view :: MonadReader s m => Getting a s a -> m a #
view
is a synonym for (^.
), generalised for MonadReader
(we are able to use it instead of (^.
) since functions are instances of the MonadReader
class):
>>>
view _1 (1, 2)
1
When you're using Reader
for config and your config type has lenses generated for it, most of the time you'll be using view
instead of asks
:
doSomething :: (MonadReader
Config m) => m Int doSomething = do thingy <-view
setting1 -- same as “asks
(^.
setting1)” anotherThingy <-view
setting2 ...