stack-1.5.0: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Types.Config

Contents

Description

The Config type.

Synopsis

Main configuration types and classes

HasPlatform & HasStackRoot

data PlatformVariant #

A variant of the platform, used to differentiate Docker builds from host

Config & HasConfig

data Config #

The top-level Stackage configuration.

Constructors

Config 

Fields

class HasPlatform env => HasConfig env where #

Class for environment values that can provide a Config.

Methods

configL :: Lens' env Config #

configL :: HasBuildConfig env => Lens' env Config #

askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text #

Get the URL to request the information on the latest snapshots

explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool #

Provide an explicit list of package dependencies when running a custom Setup.hs

getMinimalEnvOverride :: (MonadReader env m, HasConfig env, MonadIO m) => m EnvOverride #

Get the minimal environment override, useful for just calling external processes like git or ghc

BuildConfig & HasBuildConfig

data BuildConfig #

A superset of Config adding information on how to build code. The reason for this breakdown is because we will need some of the information from Config in order to determine the values here.

These are the components which know nothing about local configuration.

Constructors

BuildConfig 

Fields

projectRootL :: HasBuildConfig env => Getting r env (Path Abs Dir) #

Directory containing the project's stack.yaml file

GHCVariant & HasGHCVariant

data GHCVariant #

Specialized bariant of GHC (e.g. libgmp4 or integer-simple)

Constructors

GHCStandard

Standard bindist

GHCIntegerSimple

Bindist that uses integer-simple

GHCCustom String

Other bindists

ghcVariantName :: GHCVariant -> String #

Render a GHC variant to a String.

ghcVariantSuffix :: GHCVariant -> String #

Render a GHC variant to a String suffix.

parseGHCVariant :: MonadThrow m => String -> m GHCVariant #

Parse GHC variant from a String.

snapshotsDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Abs Dir) #

Directory containing snapshots

Constraint synonym for use with StackMini

type StackMiniM r m = (MonadReader r m, MonadIO m, MonadBaseControl IO m, MonadLoggerIO m, MonadMask m) #

Constraint synonym for constraints satisfied by a MiniConfig environment.

EnvConfig & HasEnvConfig

data EnvConfig #

Configuration after the environment has been setup.

Constructors

EnvConfig 

Fields

class (HasBuildConfig env, HasGHCVariant env) => HasEnvConfig env where #

Minimal complete definition

envConfigL

Methods

envConfigL :: Lens' env EnvConfig #

Instances

getCompilerPath :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env) => WhichCompiler -> m (Path Abs File) #

Get the path for the given compiler ignoring any local binaries.

https://github.com/commercialhaskell/stack/issues/1052

Details

ApplyGhcOptions

data ApplyGhcOptions #

Which packages do ghc-options on the command line apply to?

Constructors

AGOTargets

all local targets

AGOLocals

all local packages, even non-targets

AGOEverything

every package

Instances

Bounded ApplyGhcOptions # 
Enum ApplyGhcOptions # 
Eq ApplyGhcOptions # 
Ord ApplyGhcOptions # 
Read ApplyGhcOptions # 
Show ApplyGhcOptions # 
FromJSON ApplyGhcOptions # 

ConfigException

WhichSolverCmd

ConfigMonoid

data ConfigMonoid #

Constructors

ConfigMonoid 

Fields

Instances

Show ConfigMonoid # 
Generic ConfigMonoid # 

Associated Types

type Rep ConfigMonoid :: * -> * #

Monoid ConfigMonoid # 
type Rep ConfigMonoid # 
type Rep ConfigMonoid = D1 (MetaData "ConfigMonoid" "Stack.Types.Config" "stack-1.5.0-IuA3bCFJcEEM0Uh3GFmyz" False) (C1 (MetaCons "ConfigMonoid" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidStackRoot") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First (Path Abs Dir)))) (S1 (MetaSel (Just Symbol "configMonoidWorkDir") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First (Path Rel Dir))))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidBuildOpts") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BuildOptsMonoid)) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidDockerOpts") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 DockerOptsMonoid)) (S1 (MetaSel (Just Symbol "configMonoidNixOpts") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 NixOptsMonoid))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidConnectionCount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Int))) (S1 (MetaSel (Just Symbol "configMonoidHideTHLoading") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool)))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidLatestSnapshotUrl") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Text))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidUrls") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UrlsMonoid)) (S1 (MetaSel (Just Symbol "configMonoidPackageIndices") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First [PackageIndex]))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidSystemGHC") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "configMonoidInstallGHC") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool)))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidSkipGHCCheck") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidSkipMsys") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "configMonoidCompilerCheck") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First VersionCheck)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidRequireStackVersion") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 IntersectingVersionRange)) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidArch") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First String))) (S1 (MetaSel (Just Symbol "configMonoidGHCVariant") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First GHCVariant))))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidGHCBuild") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First CompilerBuild))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidJobs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Int))) (S1 (MetaSel (Just Symbol "configMonoidExtraIncludeDirs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Set FilePath)))))))) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidExtraLibDirs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Set FilePath))) (S1 (MetaSel (Just Symbol "configMonoidOverrideGccPath") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First (Path Abs File))))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidConcurrentTests") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidLocalBinPath") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First FilePath))) (S1 (MetaSel (Just Symbol "configMonoidImageOpts") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ImageOptsMonoid))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidTemplateParameters") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Map Text Text))) (S1 (MetaSel (Just Symbol "configMonoidScmInit") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First SCM)))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidGhcOptions") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 GhcOptions)) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidExtraPath") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [Path Abs Dir])) (S1 (MetaSel (Just Symbol "configMonoidSetupInfoLocations") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [SetupInfoLocation])))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidLocalProgramsBase") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First (Path Abs Dir)))) (S1 (MetaSel (Just Symbol "configMonoidPvpBounds") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First PvpBounds)))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidModifyCodePage") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidExplicitSetupDeps") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Map (Maybe PackageName) Bool))) (S1 (MetaSel (Just Symbol "configMonoidRebuildGhcOptions") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidApplyGhcOptions") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First ApplyGhcOptions))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidAllowNewer") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "configMonoidDefaultTemplate") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First TemplateName))))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidAllowDifferentUser") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configMonoidDumpLogs") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First DumpLogs))) (S1 (MetaSel (Just Symbol "configMonoidSaveHackageCreds") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))))))))))

DumpLogs

EnvSettings

data EnvSettings #

Controls which version of the environment is used

Constructors

EnvSettings 

Fields

GlobalOpts & GlobalOptsMonoid

data GlobalOpts #

Parsed global command-line options.

Constructors

GlobalOpts 

Fields

data GlobalOptsMonoid #

Parsed global command-line options monoid.

Constructors

GlobalOptsMonoid 

Fields

Instances

Show GlobalOptsMonoid # 
Generic GlobalOptsMonoid # 
Monoid GlobalOptsMonoid # 
type Rep GlobalOptsMonoid # 
type Rep GlobalOptsMonoid = D1 (MetaData "GlobalOptsMonoid" "Stack.Types.Config" "stack-1.5.0-IuA3bCFJcEEM0Uh3GFmyz" False) (C1 (MetaCons "GlobalOptsMonoid" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidReExecVersion") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First String))) (S1 (MetaSel (Just Symbol "globalMonoidDockerEntrypoint") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First DockerEntrypoint)))) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidLogLevel") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First LogLevel))) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidTimeInLog") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) (S1 (MetaSel (Just Symbol "globalMonoidConfigMonoid") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ConfigMonoid))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidResolver") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First AbstractResolver))) (S1 (MetaSel (Just Symbol "globalMonoidCompiler") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First CompilerVersion)))) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidTerminal") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First Bool))) ((:*:) (S1 (MetaSel (Just Symbol "globalMonoidColorWhen") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First ColorWhen))) (S1 (MetaSel (Just Symbol "globalMonoidStackYaml") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (First FilePath))))))))

data StackYamlLoc filepath #

Constructors

SYLDefault 
SYLOverride !filepath 
SYLNoConfig 

Instances

Functor StackYamlLoc # 

Methods

fmap :: (a -> b) -> StackYamlLoc a -> StackYamlLoc b #

(<$) :: a -> StackYamlLoc b -> StackYamlLoc a #

Foldable StackYamlLoc # 

Methods

fold :: Monoid m => StackYamlLoc m -> m #

foldMap :: Monoid m => (a -> m) -> StackYamlLoc a -> m #

foldr :: (a -> b -> b) -> b -> StackYamlLoc a -> b #

foldr' :: (a -> b -> b) -> b -> StackYamlLoc a -> b #

foldl :: (b -> a -> b) -> b -> StackYamlLoc a -> b #

foldl' :: (b -> a -> b) -> b -> StackYamlLoc a -> b #

foldr1 :: (a -> a -> a) -> StackYamlLoc a -> a #

foldl1 :: (a -> a -> a) -> StackYamlLoc a -> a #

toList :: StackYamlLoc a -> [a] #

null :: StackYamlLoc a -> Bool #

length :: StackYamlLoc a -> Int #

elem :: Eq a => a -> StackYamlLoc a -> Bool #

maximum :: Ord a => StackYamlLoc a -> a #

minimum :: Ord a => StackYamlLoc a -> a #

sum :: Num a => StackYamlLoc a -> a #

product :: Num a => StackYamlLoc a -> a #

Traversable StackYamlLoc # 

Methods

traverse :: Applicative f => (a -> f b) -> StackYamlLoc a -> f (StackYamlLoc b) #

sequenceA :: Applicative f => StackYamlLoc (f a) -> f (StackYamlLoc a) #

mapM :: Monad m => (a -> m b) -> StackYamlLoc a -> m (StackYamlLoc b) #

sequence :: Monad m => StackYamlLoc (m a) -> m (StackYamlLoc a) #

Show filepath => Show (StackYamlLoc filepath) # 

Methods

showsPrec :: Int -> StackYamlLoc filepath -> ShowS #

show :: StackYamlLoc filepath -> String #

showList :: [StackYamlLoc filepath] -> ShowS #

defaultLogLevel :: LogLevel #

Default logging level should be something useful but not crazy.

LoadConfig

data LoadConfig m #

Value returned by loadConfig.

Constructors

LoadConfig 

Fields

PackageEntry & PackageLocation

type TreatLikeExtraDep = Bool #

Should a package be treated just like an extra-dep?

True means, it will only be built as a dependency for others, and its test suite/benchmarks will not be run.

Useful modifying an upstream package, see: https://github.com/commercialhaskell/stack/issues/219 https://github.com/commercialhaskell/stack/issues/386

data PackageLocation #

Constructors

PLFilePath FilePath

Note that we use FilePath and not Paths. The goal is: first parse the value raw, and then use canonicalizePath and parseAbsDir.

PLRemote Text RemotePackageType

URL and further details

PackageIndex, IndexName & IndexLocation

data PackageIndex #

Information on a single package index

Constructors

PackageIndex 

Fields

configPackageIndex :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) #

Location of the 01-index.tar file

configPackageIndexOld :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) #

Location of the 00-index.tar file. This file is just a copy of the 01-index.tar file, provided for tools which still look for the 00-index.tar file.

configPackageIndexCache :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) #

Location of the 01-index.cache file

configPackageIndexCacheOld :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) #

Location of the 00-index.cache file

configPackageIndexGz :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) #

Location of the 01-index.tar.gz file

configPackageIndexRoot :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs Dir) #

Root for a specific package index

configPackageTarball :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> PackageIdentifier -> m (Path Abs File) #

Location of a package tarball

Project & ProjectAndConfigMonoid

data Project #

A project is a collection of packages. We can have multiple stack.yaml files, but only one of them may contain project information.

Constructors

Project 

Fields

PvpBounds

data PvpBoundsType #

How PVP bounds should be added to .cabal files

ColorWhen

data ColorWhen #

Instances

Show ColorWhen # 
Generic ColorWhen # 

Associated Types

type Rep ColorWhen :: * -> * #

type Rep ColorWhen # 
type Rep ColorWhen = D1 (MetaData "ColorWhen" "Stack.Types.Config" "stack-1.5.0-IuA3bCFJcEEM0Uh3GFmyz" False) ((:+:) (C1 (MetaCons "ColorNever" PrefixI False) U1) ((:+:) (C1 (MetaCons "ColorAlways" PrefixI False) U1) (C1 (MetaCons "ColorAuto" PrefixI False) U1)))

SCM

data SCM #

A software control system.

Constructors

Git 

CustomSnapshot

GhcOptions

PackageFlags

Paths

bindirSuffix :: Path Rel Dir #

Suffix applied to an installation root to get the bin dir

configInstalledCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File) #

File containing the installed cache, see Stack.PackageDump

configMiniBuildPlanCache :: (MonadThrow m, MonadReader env m, HasConfig env, HasGHCVariant env) => SnapName -> m (Path Abs File) #

Where to store mini build plan caches

getProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir) #

Per-project work dir

docDirSuffix :: Path Rel Dir #

Suffix applied to an installation root to get the doc dir

flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Directory for holding flag cache information

extraBinDirs :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Bool -> [Path Abs Dir]) #

Get the extra bin directories (for the PATH). Puts more local first

Bool indicates whether or not to include the locals

hpcReportDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Where HPC reports and tix files get stored.

installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Installation root for dependencies

installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Installation root for locals

hoogleRoot :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Hoogle directory.

hoogleDatabasePath :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs File) #

Get the hoogle database path.

packageDatabaseDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Package database for installing dependencies into

packageDatabaseExtra :: (MonadReader env m, HasEnvConfig env) => m [Path Abs Dir] #

Extra package databases

packageDatabaseLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) #

Package database for installing local packages into

platformOnlyRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir) #

Relative directory for the platform identifier

platformGhcRelDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Rel Dir) #

Relative directory for the platform and GHC identifier

platformGhcVerOnlyRelDir :: (MonadReader env m, HasPlatform env, HasGHCVariant env, MonadThrow m) => m (Path Rel Dir) #

Relative directory for the platform and GHC identifier without GHC bindist build

useShaPathOnWindows :: MonadThrow m => Path Rel Dir -> m (Path Rel Dir) #

This is an attempt to shorten stack paths on Windows to decrease our chances of hitting 260 symbol path limit. The idea is to calculate SHA1 hash of the path used on other architectures, encode with base 16 and take first 8 symbols of it.

workDirL :: HasConfig env => Lens' env (Path Rel Dir) #

".stack-work"

Command-specific types

Eval

data EvalOpts #

Constructors

EvalOpts 

Instances

Exec

data ExecOpts #

Constructors

ExecOpts 

Instances

Setup

data DownloadInfo #

Build of the compiler distribution (e.g. standard, gmp4, tinfo6) | Information for a file to download.

Docker entrypoint

newtype DockerEntrypoint #

Data passed into Docker container for the Docker entrypoint's use

Constructors

DockerEntrypoint 

Fields

data DockerUser #

Docker host user info

Constructors

DockerUser 

Fields

Lens helpers

wantedCompilerVersionL :: HasBuildConfig s => Lens' s CompilerVersion #

The compiler specified by the MiniBuildPlan. This may be different from the actual compiler used!

actualCompilerVersionL :: HasEnvConfig s => Lens' s CompilerVersion #

The version of the compiler which will actually be used. May be different than that specified in the MiniBuildPlan and returned by wantedCompilerVersionL.

Lens reexport

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

to :: (s -> a) -> SimpleGetter s a #

to creates a getter from any function:

a ^. to f = f a

It's most useful in chains, because it lets you mix lenses and ordinary functions. Suppose you have a record which comes from some third-party library and doesn't have any lens accessors. You want to do something like this:

value ^. _1 . field . at 2

However, field isn't a getter, and you have to do this instead:

field (value ^. _1) ^. at 2

but now value is in the middle and it's hard to read the resulting code. A variant with to is prettier and more readable:

value ^. _1 . to field . at 2