stack-1.4.0: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Stack.Types.Internal

Description

Internal types to the library.

Synopsis

- 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 {
  - unSticky :: Maybe (MVar (Maybe Text))
  }
- class HasSticky env where
- data LogOptions = LogOptions {
  - logUseColor :: Bool
  - logUseUnicode :: Bool
  - logUseTime :: Bool
  - logMinLevel :: LogLevel
  - logVerboseFormat :: Bool
  }
- class HasLogOptions env where
- view :: MonadReader s m => Getting a s a -> m a

# Documentation

data Env config #

Monadic environment.

Constructors

Env |
Fields envConfig :: !config envReExec :: !Bool envLogOptions :: !LogOptions envTerminal :: !Bool envSticky :: !Sticky

Instances

HasEnvConfig config => HasEnvConfig (Env config) # |
Methods envConfigL :: Lens' (Env config) EnvConfig #
HasBuildConfig config => HasBuildConfig (Env config) # |
Methods buildConfigL :: Lens' (Env config) BuildConfig #
HasConfig config => HasConfig (Env config) # |
Methods configL :: Lens' (Env config) Config #
HasGHCVariant config => HasGHCVariant (Env config) # |
Methods ghcVariantL :: Lens' (Env config) GHCVariant #
HasPlatform config => HasPlatform (Env config) # |
Methods platformL :: Lens' (Env config) Platform # platformVariantL :: Lens' (Env config) PlatformVariant #
HasLogOptions (Env config) # |
Methods logOptionsL :: Lens' (Env config) LogOptions #
HasSticky (Env config) # |
Methods stickyL :: Lens' (Env config) Sticky #
HasReExec (Env config) # |
Methods reExecL :: Lens' (Env config) Bool #
HasTerminal (Env config) # |
Methods terminalL :: Lens' (Env config) Bool #
Monad m => MonadReader (Env config) (StackT config m) # |
Methods ask :: StackT config m (Env config) # local :: (Env config -> Env config) -> StackT config m a -> StackT config m a # reader :: (Env config -> a) -> StackT config m a #

class HasTerminal env where #

Minimal complete definition

terminalL

Methods

terminalL :: Lens' env Bool #

Instances

HasTerminal (Env config) # |
Methods terminalL :: Lens' (Env config) Bool #

class HasReExec env where #

Minimal complete definition

reExecL

Methods

reExecL :: Lens' env Bool #

Instances

HasReExec (Env config) # |
Methods reExecL :: Lens' (Env config) Bool #

newtype Sticky #

Constructors

Sticky |
Fields unSticky :: Maybe (MVar (Maybe Text))

class HasSticky env where #

Minimal complete definition

stickyL

Methods

stickyL :: Lens' env Sticky #

Instances

HasSticky (Env config) # |
Methods stickyL :: Lens' (Env config) Sticky #

data LogOptions #

Constructors

LogOptions |
Fields logUseColor :: Bool logUseUnicode :: Bool logUseTime :: Bool logMinLevel :: LogLevel logVerboseFormat :: Bool

class HasLogOptions env where #

Minimal complete definition

logOptionsL

Methods

logOptionsL :: Lens' env LogOptions #

Instances

HasLogOptions (Env config) # |
Methods logOptionsL :: Lens' (Env config) LogOptions #

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
      ...