{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards   #-}

-- | Types and functions related to Stack's @path@ command.

module Stack.Path
  ( PathInfo
  , path
  , paths
  ) where

import           Data.List ( intercalate )
import qualified Data.Text as T
import qualified Data.Text.IO as T
import           Path ( (</>), parent )
import           Path.Extra ( toFilePathNoTrailingSep )
import           RIO.Process ( HasProcessContext (..), exeSearchPathL )
import           Stack.Constants
                   ( docDirSuffix, stackGlobalConfigOptionName
                   , stackRootOptionName
                   )
import           Stack.Constants.Config ( distRelativeDir )
import           Stack.GhcPkg as GhcPkg
import           Stack.Prelude
import           Stack.Runners
                   ( ShouldReexec (..), withConfig, withDefaultEnvConfig )
import           Stack.Types.BuildConfig
                   ( BuildConfig (..), HasBuildConfig (..), projectRootL
                   , stackYamlL
                   )
import           Stack.Types.BuildOpts ( buildOptsMonoidHaddockL )
import           Stack.Types.CompilerPaths
                   ( CompilerPaths (..), HasCompiler (..), getCompilerPath )
import           Stack.Types.Config
                   ( Config (..), HasConfig (..), stackGlobalConfigL, stackRootL
                   )
import           Stack.Types.EnvConfig
                   ( EnvConfig, HasEnvConfig (..), bindirCompilerTools
                   , hoogleRoot, hpcReportDir, installationRootDeps
                   , installationRootLocal, packageDatabaseDeps
                   , packageDatabaseExtra, packageDatabaseLocal
                   )
import           Stack.Types.GHCVariant ( HasGHCVariant (..) )
import           Stack.Types.GlobalOpts ( globalOptsBuildOptsMonoidL )
import           Stack.Types.Platform ( HasPlatform (..) )
import           Stack.Types.Runner ( HasRunner (..), Runner, globalOptsL )
import qualified System.FilePath as FP

-- | Print out useful path information in a human-readable format (and

-- support others later).

path :: [Text] -> RIO Runner ()
path :: [Text] -> RIO Runner ()
path [Text]
keys = do
  let -- filter the chosen paths in flags (keys), or show all of them if no

      -- specific paths chosen.

      goodPaths :: [(String, Text, UseHaddocks (PathInfo -> Text))]
goodPaths = ((String, Text, UseHaddocks (PathInfo -> Text)) -> Bool)
-> [(String, Text, UseHaddocks (PathInfo -> Text))]
-> [(String, Text, UseHaddocks (PathInfo -> Text))]
forall a. (a -> Bool) -> [a] -> [a]
filter
        ( \(String
_, Text
key, UseHaddocks (PathInfo -> Text)
_) -> [Text] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Text]
keys Bool -> Bool -> Bool
|| Text -> [Text] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem Text
key [Text]
keys )
        [(String, Text, UseHaddocks (PathInfo -> Text))]
paths
      singlePath :: Bool
singlePath = [(String, Text, UseHaddocks (PathInfo -> Text))] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(String, Text, UseHaddocks (PathInfo -> Text))]
goodPaths Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1
      toEither :: (a, a, UseHaddocks b) -> Either (a, b) (a, b)
toEither (a
_, a
k, UseHaddocks b
p) = (a, b) -> Either (a, b) (a, b)
forall a b. a -> Either a b
Left (a
k, b
p)
      toEither (a
_, a
k, WithoutHaddocks b
p) = (a, b) -> Either (a, b) (a, b)
forall a b. b -> Either a b
Right (a
k, b
p)
      ([(Text, PathInfo -> Text)]
with, [(Text, PathInfo -> Text)]
without) = [Either (Text, PathInfo -> Text) (Text, PathInfo -> Text)]
-> ([(Text, PathInfo -> Text)], [(Text, PathInfo -> Text)])
forall a b. [Either a b] -> ([a], [b])
partitionEithers ([Either (Text, PathInfo -> Text) (Text, PathInfo -> Text)]
 -> ([(Text, PathInfo -> Text)], [(Text, PathInfo -> Text)]))
-> [Either (Text, PathInfo -> Text) (Text, PathInfo -> Text)]
-> ([(Text, PathInfo -> Text)], [(Text, PathInfo -> Text)])
forall a b. (a -> b) -> a -> b
$ ((String, Text, UseHaddocks (PathInfo -> Text))
 -> Either (Text, PathInfo -> Text) (Text, PathInfo -> Text))
-> [(String, Text, UseHaddocks (PathInfo -> Text))]
-> [Either (Text, PathInfo -> Text) (Text, PathInfo -> Text)]
forall a b. (a -> b) -> [a] -> [b]
map (String, Text, UseHaddocks (PathInfo -> Text))
-> Either (Text, PathInfo -> Text) (Text, PathInfo -> Text)
forall {a} {a} {b}. (a, a, UseHaddocks b) -> Either (a, b) (a, b)
toEither [(String, Text, UseHaddocks (PathInfo -> Text))]
goodPaths
  Bool -> RIO EnvConfig () -> RIO Runner ()
runHaddock Bool
True (RIO EnvConfig () -> RIO Runner ())
-> RIO EnvConfig () -> RIO Runner ()
forall a b. (a -> b) -> a -> b
$ [(Text, PathInfo -> Text)] -> Bool -> RIO EnvConfig ()
forall env.
HasEnvConfig env =>
[(Text, PathInfo -> Text)] -> Bool -> RIO env ()
printKeys [(Text, PathInfo -> Text)]
with Bool
singlePath
  Bool -> RIO EnvConfig () -> RIO Runner ()
runHaddock Bool
False (RIO EnvConfig () -> RIO Runner ())
-> RIO EnvConfig () -> RIO Runner ()
forall a b. (a -> b) -> a -> b
$ [(Text, PathInfo -> Text)] -> Bool -> RIO EnvConfig ()
forall env.
HasEnvConfig env =>
[(Text, PathInfo -> Text)] -> Bool -> RIO env ()
printKeys [(Text, PathInfo -> Text)]
without Bool
singlePath

printKeys ::
     HasEnvConfig env
  => [(Text, PathInfo -> Text)]
  -> Bool
  -> RIO env ()
printKeys :: forall env.
HasEnvConfig env =>
[(Text, PathInfo -> Text)] -> Bool -> RIO env ()
printKeys [(Text, PathInfo -> Text)]
extractors Bool
single = do
  PathInfo
pathInfo <- RIO env PathInfo
forall env. HasEnvConfig env => RIO env PathInfo
fillPathInfo
  IO () -> RIO env ()
forall a. IO a -> RIO env a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> RIO env ()) -> IO () -> RIO env ()
forall a b. (a -> b) -> a -> b
$ [(Text, PathInfo -> Text)]
-> ((Text, PathInfo -> Text) -> IO ()) -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ [(Text, PathInfo -> Text)]
extractors (((Text, PathInfo -> Text) -> IO ()) -> IO ())
-> ((Text, PathInfo -> Text) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \(Text
key, PathInfo -> Text
extractPath) -> do
    let prefix :: Text
prefix = if Bool
single then Text
"" else Text
key Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
": "
    Text -> IO ()
T.putStrLn (Text -> IO ()) -> Text -> IO ()
forall a b. (a -> b) -> a -> b
$ Text
prefix Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> PathInfo -> Text
extractPath PathInfo
pathInfo

runHaddock :: Bool -> RIO EnvConfig () -> RIO Runner ()
runHaddock :: Bool -> RIO EnvConfig () -> RIO Runner ()
runHaddock Bool
x RIO EnvConfig ()
action = (Runner -> Runner) -> RIO Runner () -> RIO Runner ()
forall a. (Runner -> Runner) -> RIO Runner a -> RIO Runner a
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local Runner -> Runner
modifyConfig (RIO Runner () -> RIO Runner ()) -> RIO Runner () -> RIO Runner ()
forall a b. (a -> b) -> a -> b
$
  ShouldReexec -> RIO Config () -> RIO Runner ()
forall a. ShouldReexec -> RIO Config a -> RIO Runner a
withConfig ShouldReexec
YesReexec (RIO Config () -> RIO Runner ()) -> RIO Config () -> RIO Runner ()
forall a b. (a -> b) -> a -> b
$
    RIO EnvConfig () -> RIO Config ()
forall a. RIO EnvConfig a -> RIO Config a
withDefaultEnvConfig RIO EnvConfig ()
action
 where
  modifyConfig :: Runner -> Runner
modifyConfig = ASetter Runner Runner (Maybe Bool) (Maybe Bool)
-> Maybe Bool -> Runner -> Runner
forall s t a b. ASetter s t a b -> b -> s -> t
set
    ((GlobalOpts -> Identity GlobalOpts) -> Runner -> Identity Runner
forall env. HasRunner env => Lens' env GlobalOpts
Lens' Runner GlobalOpts
globalOptsL((GlobalOpts -> Identity GlobalOpts) -> Runner -> Identity Runner)
-> ((Maybe Bool -> Identity (Maybe Bool))
    -> GlobalOpts -> Identity GlobalOpts)
-> ASetter Runner Runner (Maybe Bool) (Maybe Bool)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(BuildOptsMonoid -> Identity BuildOptsMonoid)
-> GlobalOpts -> Identity GlobalOpts
Lens' GlobalOpts BuildOptsMonoid
globalOptsBuildOptsMonoidL((BuildOptsMonoid -> Identity BuildOptsMonoid)
 -> GlobalOpts -> Identity GlobalOpts)
-> ((Maybe Bool -> Identity (Maybe Bool))
    -> BuildOptsMonoid -> Identity BuildOptsMonoid)
-> (Maybe Bool -> Identity (Maybe Bool))
-> GlobalOpts
-> Identity GlobalOpts
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Maybe Bool -> Identity (Maybe Bool))
-> BuildOptsMonoid -> Identity BuildOptsMonoid
Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidHaddockL) (Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
x)

fillPathInfo :: HasEnvConfig env => RIO env PathInfo
fillPathInfo :: forall env. HasEnvConfig env => RIO env PathInfo
fillPathInfo = do
  -- We must use a BuildConfig from an EnvConfig to ensure that it contains the

  -- full environment info including GHC paths etc.

  BuildConfig
piBuildConfig <- Getting BuildConfig env BuildConfig -> RIO env BuildConfig
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (Getting BuildConfig env BuildConfig -> RIO env BuildConfig)
-> Getting BuildConfig env BuildConfig -> RIO env BuildConfig
forall a b. (a -> b) -> a -> b
$ (EnvConfig -> Const BuildConfig EnvConfig)
-> env -> Const BuildConfig env
forall env. HasEnvConfig env => Lens' env EnvConfig
Lens' env EnvConfig
envConfigL((EnvConfig -> Const BuildConfig EnvConfig)
 -> env -> Const BuildConfig env)
-> ((BuildConfig -> Const BuildConfig BuildConfig)
    -> EnvConfig -> Const BuildConfig EnvConfig)
-> Getting BuildConfig env BuildConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(BuildConfig -> Const BuildConfig BuildConfig)
-> EnvConfig -> Const BuildConfig EnvConfig
forall env. HasBuildConfig env => Lens' env BuildConfig
Lens' EnvConfig BuildConfig
buildConfigL
  -- This is the modified 'bin-path',

  -- including the local GHC or MSYS if not configured to operate on

  -- global GHC.

  -- It was set up in 'withBuildConfigAndLock -> withBuildConfigExt -> setupEnv'.

  -- So it's not the *minimal* override path.

  Path Abs Dir
piSnapDb <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
packageDatabaseDeps
  Path Abs Dir
piLocalDb <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
packageDatabaseLocal
  [Path Abs Dir]
piExtraDbs <- RIO env [Path Abs Dir]
forall env (m :: * -> *).
(HasEnvConfig env, MonadReader env m) =>
m [Path Abs Dir]
packageDatabaseExtra
  Path Abs Dir
piGlobalDb <- Getting (Path Abs Dir) env (Path Abs Dir) -> RIO env (Path Abs Dir)
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (Getting (Path Abs Dir) env (Path Abs Dir)
 -> RIO env (Path Abs Dir))
-> Getting (Path Abs Dir) env (Path Abs Dir)
-> RIO env (Path Abs Dir)
forall a b. (a -> b) -> a -> b
$ Getting (Path Abs Dir) env CompilerPaths
forall env. HasCompiler env => SimpleGetter env CompilerPaths
SimpleGetter env CompilerPaths
compilerPathsLGetting (Path Abs Dir) env CompilerPaths
-> ((Path Abs Dir -> Const (Path Abs Dir) (Path Abs Dir))
    -> CompilerPaths -> Const (Path Abs Dir) CompilerPaths)
-> Getting (Path Abs Dir) env (Path Abs Dir)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(CompilerPaths -> Path Abs Dir)
-> SimpleGetter CompilerPaths (Path Abs Dir)
forall s a. (s -> a) -> SimpleGetter s a
to CompilerPaths -> Path Abs Dir
cpGlobalDB
  Path Abs Dir
piSnapRoot <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
installationRootDeps
  Path Abs Dir
piLocalRoot <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
installationRootLocal
  Path Abs Dir
piToolsDir <- RIO env (Path Abs Dir)
forall env (m :: * -> *).
(HasEnvConfig env, MonadReader env m, MonadThrow m) =>
m (Path Abs Dir)
bindirCompilerTools
  Path Abs Dir
piHoogleRoot <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
hoogleRoot
  Path Rel Dir
piDistDir <- RIO env (Path Rel Dir)
forall env (m :: * -> *).
(HasEnvConfig env, MonadReader env m, MonadThrow m) =>
m (Path Rel Dir)
distRelativeDir
  Path Abs Dir
piHpcDir <- RIO env (Path Abs Dir)
forall env. HasEnvConfig env => RIO env (Path Abs Dir)
hpcReportDir
  Path Abs File
piCompiler <- RIO env (Path Abs File)
forall env. HasCompiler env => RIO env (Path Abs File)
getCompilerPath
  PathInfo -> RIO env PathInfo
forall a. a -> RIO env a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PathInfo {[Path Abs Dir]
Path Rel Dir
Path Abs Dir
Path Abs File
BuildConfig
piBuildConfig :: BuildConfig
piSnapDb :: Path Abs Dir
piLocalDb :: Path Abs Dir
piExtraDbs :: [Path Abs Dir]
piGlobalDb :: Path Abs Dir
piSnapRoot :: Path Abs Dir
piLocalRoot :: Path Abs Dir
piToolsDir :: Path Abs Dir
piHoogleRoot :: Path Abs Dir
piDistDir :: Path Rel Dir
piHpcDir :: Path Abs Dir
piCompiler :: Path Abs File
piBuildConfig :: BuildConfig
piSnapDb :: Path Abs Dir
piLocalDb :: Path Abs Dir
piGlobalDb :: Path Abs Dir
piSnapRoot :: Path Abs Dir
piLocalRoot :: Path Abs Dir
piToolsDir :: Path Abs Dir
piHoogleRoot :: Path Abs Dir
piDistDir :: Path Rel Dir
piHpcDir :: Path Abs Dir
piExtraDbs :: [Path Abs Dir]
piCompiler :: Path Abs File
..}

-- | Type representing information passed to all the path printers.

data PathInfo = PathInfo
  { PathInfo -> BuildConfig
piBuildConfig  :: !BuildConfig
  , PathInfo -> Path Abs Dir
piSnapDb       :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piLocalDb      :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piGlobalDb     :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piSnapRoot     :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piLocalRoot    :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piToolsDir     :: !(Path Abs Dir)
  , PathInfo -> Path Abs Dir
piHoogleRoot   :: !(Path Abs Dir)
  , PathInfo -> Path Rel Dir
piDistDir      :: Path Rel Dir
  , PathInfo -> Path Abs Dir
piHpcDir       :: !(Path Abs Dir)
  , PathInfo -> [Path Abs Dir]
piExtraDbs     :: ![Path Abs Dir]
  , PathInfo -> Path Abs File
piCompiler     :: !(Path Abs File)
  }

instance HasPlatform PathInfo where
  platformL :: Lens' PathInfo Platform
platformL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((Platform -> f Platform) -> Config -> f Config)
-> (Platform -> f Platform)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Platform -> f Platform) -> Config -> f Config
forall env. HasPlatform env => Lens' env Platform
Lens' Config Platform
platformL
  {-# INLINE platformL #-}
  platformVariantL :: Lens' PathInfo PlatformVariant
platformVariantL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((PlatformVariant -> f PlatformVariant) -> Config -> f Config)
-> (PlatformVariant -> f PlatformVariant)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(PlatformVariant -> f PlatformVariant) -> Config -> f Config
forall env. HasPlatform env => Lens' env PlatformVariant
Lens' Config PlatformVariant
platformVariantL
  {-# INLINE platformVariantL #-}

instance HasLogFunc PathInfo where
  logFuncL :: Lens' PathInfo LogFunc
logFuncL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((LogFunc -> f LogFunc) -> Config -> f Config)
-> (LogFunc -> f LogFunc)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(LogFunc -> f LogFunc) -> Config -> f Config
forall env. HasLogFunc env => Lens' env LogFunc
Lens' Config LogFunc
logFuncL

instance HasRunner PathInfo where
  runnerL :: Lens' PathInfo Runner
runnerL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((Runner -> f Runner) -> Config -> f Config)
-> (Runner -> f Runner)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Runner -> f Runner) -> Config -> f Config
forall env. HasRunner env => Lens' env Runner
Lens' Config Runner
runnerL

instance HasStylesUpdate PathInfo where
  stylesUpdateL :: Lens' PathInfo StylesUpdate
stylesUpdateL = (Runner -> f Runner) -> PathInfo -> f PathInfo
forall env. HasRunner env => Lens' env Runner
Lens' PathInfo Runner
runnerL((Runner -> f Runner) -> PathInfo -> f PathInfo)
-> ((StylesUpdate -> f StylesUpdate) -> Runner -> f Runner)
-> (StylesUpdate -> f StylesUpdate)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(StylesUpdate -> f StylesUpdate) -> Runner -> f Runner
forall env. HasStylesUpdate env => Lens' env StylesUpdate
Lens' Runner StylesUpdate
stylesUpdateL

instance HasTerm PathInfo where
  useColorL :: Lens' PathInfo Bool
useColorL = (Runner -> f Runner) -> PathInfo -> f PathInfo
forall env. HasRunner env => Lens' env Runner
Lens' PathInfo Runner
runnerL((Runner -> f Runner) -> PathInfo -> f PathInfo)
-> ((Bool -> f Bool) -> Runner -> f Runner)
-> (Bool -> f Bool)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Bool -> f Bool) -> Runner -> f Runner
forall env. HasTerm env => Lens' env Bool
Lens' Runner Bool
useColorL
  termWidthL :: Lens' PathInfo Int
termWidthL = (Runner -> f Runner) -> PathInfo -> f PathInfo
forall env. HasRunner env => Lens' env Runner
Lens' PathInfo Runner
runnerL((Runner -> f Runner) -> PathInfo -> f PathInfo)
-> ((Int -> f Int) -> Runner -> f Runner)
-> (Int -> f Int)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Int -> f Int) -> Runner -> f Runner
forall env. HasTerm env => Lens' env Int
Lens' Runner Int
termWidthL

instance HasGHCVariant PathInfo where
  ghcVariantL :: SimpleGetter PathInfo GHCVariant
ghcVariantL = (Config -> Const r Config) -> PathInfo -> Const r PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> Const r Config) -> PathInfo -> Const r PathInfo)
-> ((GHCVariant -> Const r GHCVariant) -> Config -> Const r Config)
-> (GHCVariant -> Const r GHCVariant)
-> PathInfo
-> Const r PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(GHCVariant -> Const r GHCVariant) -> Config -> Const r Config
forall env. HasGHCVariant env => SimpleGetter env GHCVariant
SimpleGetter Config GHCVariant
ghcVariantL
  {-# INLINE ghcVariantL #-}

instance HasConfig PathInfo where
  configL :: Lens' PathInfo Config
configL = (BuildConfig -> f BuildConfig) -> PathInfo -> f PathInfo
forall env. HasBuildConfig env => Lens' env BuildConfig
Lens' PathInfo BuildConfig
buildConfigL((BuildConfig -> f BuildConfig) -> PathInfo -> f PathInfo)
-> ((Config -> f Config) -> BuildConfig -> f BuildConfig)
-> (Config -> f Config)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(BuildConfig -> Config)
-> (BuildConfig -> Config -> BuildConfig)
-> Lens BuildConfig BuildConfig Config Config
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens BuildConfig -> Config
bcConfig (\BuildConfig
x Config
y -> BuildConfig
x { bcConfig :: Config
bcConfig = Config
y })
  {-# INLINE configL #-}

instance HasPantryConfig PathInfo where
  pantryConfigL :: Lens' PathInfo PantryConfig
pantryConfigL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((PantryConfig -> f PantryConfig) -> Config -> f Config)
-> (PantryConfig -> f PantryConfig)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(PantryConfig -> f PantryConfig) -> Config -> f Config
forall env. HasPantryConfig env => Lens' env PantryConfig
Lens' Config PantryConfig
pantryConfigL

instance HasProcessContext PathInfo where
  processContextL :: Lens' PathInfo ProcessContext
processContextL = (Config -> f Config) -> PathInfo -> f PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> f Config) -> PathInfo -> f PathInfo)
-> ((ProcessContext -> f ProcessContext) -> Config -> f Config)
-> (ProcessContext -> f ProcessContext)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(ProcessContext -> f ProcessContext) -> Config -> f Config
forall env. HasProcessContext env => Lens' env ProcessContext
Lens' Config ProcessContext
processContextL

instance HasBuildConfig PathInfo where
  buildConfigL :: Lens' PathInfo BuildConfig
buildConfigL = (PathInfo -> BuildConfig)
-> (PathInfo -> BuildConfig -> PathInfo)
-> Lens' PathInfo BuildConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens PathInfo -> BuildConfig
piBuildConfig (\PathInfo
x BuildConfig
y -> PathInfo
x { piBuildConfig :: BuildConfig
piBuildConfig = BuildConfig
y })
                 ((BuildConfig -> f BuildConfig) -> PathInfo -> f PathInfo)
-> ((BuildConfig -> f BuildConfig) -> BuildConfig -> f BuildConfig)
-> (BuildConfig -> f BuildConfig)
-> PathInfo
-> f PathInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BuildConfig -> f BuildConfig) -> BuildConfig -> f BuildConfig
forall env. HasBuildConfig env => Lens' env BuildConfig
Lens' BuildConfig BuildConfig
buildConfigL

data UseHaddocks a
  = UseHaddocks a
  | WithoutHaddocks a

-- | The paths of interest to a user. The first tuple string is used for a

-- description that the optparse flag uses, and the second string as a

-- machine-readable key and also for @--foo@ flags. The user can choose a

-- specific path to list like @--stack-root@. But really it's mainly for the

-- documentation aspect.

--

-- When printing output we generate @PathInfo@ and pass it to the function to

-- generate an appropriate string. Trailing slashes are removed, see #506.

paths :: [(String, Text, UseHaddocks (PathInfo -> Text))]
paths :: [(String, Text, UseHaddocks (PathInfo -> Text))]
paths =
  [ ( String
"Global Stack root directory"
    , String -> Text
T.pack String
stackRootOptionName
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((Path Abs Dir -> Const Text (Path Abs Dir))
-> PathInfo -> Const Text PathInfo
forall s. HasConfig s => Lens' s (Path Abs Dir)
Lens' PathInfo (Path Abs Dir)
stackRootL((Path Abs Dir -> Const Text (Path Abs Dir))
 -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text)
    -> Path Abs Dir -> Const Text (Path Abs Dir))
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs Dir -> String) -> SimpleGetter (Path Abs Dir) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSepGetting Text (Path Abs Dir) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs Dir
-> Const Text (Path Abs Dir)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack))
  , ( String
"Global Stack configuration file"
    , String -> Text
T.pack String
stackGlobalConfigOptionName
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((Path Abs File -> Const Text (Path Abs File))
-> PathInfo -> Const Text PathInfo
forall s. HasConfig s => Lens' s (Path Abs File)
Lens' PathInfo (Path Abs File)
stackGlobalConfigL((Path Abs File -> Const Text (Path Abs File))
 -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text)
    -> Path Abs File -> Const Text (Path Abs File))
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs File -> String) -> SimpleGetter (Path Abs File) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs File -> String
forall b t. Path b t -> String
toFilePathGetting Text (Path Abs File) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs File
-> Const Text (Path Abs File)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack))
  , ( String
"Project root (derived from stack.yaml file)"
    , Text
"project-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((Path Abs Dir -> Const Text (Path Abs Dir))
-> PathInfo -> Const Text PathInfo
forall env r. HasBuildConfig env => Getting r env (Path Abs Dir)
projectRootL((Path Abs Dir -> Const Text (Path Abs Dir))
 -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text)
    -> Path Abs Dir -> Const Text (Path Abs Dir))
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs Dir -> String) -> SimpleGetter (Path Abs Dir) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSepGetting Text (Path Abs Dir) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs Dir
-> Const Text (Path Abs Dir)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack))
  , ( String
"Configuration location (where the stack.yaml file is)"
    , Text
"config-location"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((Path Abs File -> Const Text (Path Abs File))
-> PathInfo -> Const Text PathInfo
forall env. HasBuildConfig env => Lens' env (Path Abs File)
Lens' PathInfo (Path Abs File)
stackYamlL((Path Abs File -> Const Text (Path Abs File))
 -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text)
    -> Path Abs File -> Const Text (Path Abs File))
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs File -> String) -> SimpleGetter (Path Abs File) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs File -> String
forall b t. Path b t -> String
toFilePathGetting Text (Path Abs File) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs File
-> Const Text (Path Abs File)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack))
  , ( String
"PATH environment variable"
    , Text
"bin-path"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate [Char
FP.searchPathSeparator] ([String] -> String)
-> (PathInfo -> [String]) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting [String] PathInfo [String] -> PathInfo -> [String]
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting [String] PathInfo [String]
forall env. HasProcessContext env => SimpleGetter env [String]
SimpleGetter PathInfo [String]
exeSearchPathL)
  , ( String
"Install location for GHC and other core tools (see 'stack ls tools' command)"
    , Text
"programs"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((Config -> Const Text Config) -> PathInfo -> Const Text PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> Const Text Config) -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text) -> Config -> Const Text Config)
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Config -> Path Abs Dir) -> SimpleGetter Config (Path Abs Dir)
forall s a. (s -> a) -> SimpleGetter s a
to Config -> Path Abs Dir
configLocalProgramsGetting Text Config (Path Abs Dir)
-> ((Text -> Const Text Text)
    -> Path Abs Dir -> Const Text (Path Abs Dir))
-> (Text -> Const Text Text)
-> Config
-> Const Text Config
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs Dir -> String) -> SimpleGetter (Path Abs Dir) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSepGetting Text (Path Abs Dir) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs Dir
-> Const Text (Path Abs Dir)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack))
  , ( String
"Compiler binary (e.g. ghc)"
    , Text
"compiler-exe"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs File -> String
forall b t. Path b t -> String
toFilePath (Path Abs File -> String)
-> (PathInfo -> Path Abs File) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs File
piCompiler )
  , ( String
"Directory containing the compiler binary (e.g. ghc)"
    , Text
"compiler-bin"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs File -> Path Abs Dir
forall b t. Path b t -> Path b Dir
parent (Path Abs File -> Path Abs Dir)
-> (PathInfo -> Path Abs File) -> PathInfo -> Path Abs Dir
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs File
piCompiler )
  , ( String
"Directory containing binaries specific to a particular compiler (e.g. intero)"
    , Text
"compiler-tools-bin"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piToolsDir )
  , ( String
"Directory where Stack installs executables (e.g. ~/.local/bin (Unix-like OSs) or %APPDATA%\\local\\bin (Windows))"
    , Text
"local-bin"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        Getting Text PathInfo Text -> PathInfo -> Text
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view (Getting Text PathInfo Text -> PathInfo -> Text)
-> Getting Text PathInfo Text -> PathInfo -> Text
forall a b. (a -> b) -> a -> b
$ (Config -> Const Text Config) -> PathInfo -> Const Text PathInfo
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL((Config -> Const Text Config) -> PathInfo -> Const Text PathInfo)
-> ((Text -> Const Text Text) -> Config -> Const Text Config)
-> Getting Text PathInfo Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Config -> Path Abs Dir) -> SimpleGetter Config (Path Abs Dir)
forall s a. (s -> a) -> SimpleGetter s a
to Config -> Path Abs Dir
configLocalBinGetting Text Config (Path Abs Dir)
-> ((Text -> Const Text Text)
    -> Path Abs Dir -> Const Text (Path Abs Dir))
-> (Text -> Const Text Text)
-> Config
-> Const Text Config
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Path Abs Dir -> String) -> SimpleGetter (Path Abs Dir) String
forall s a. (s -> a) -> SimpleGetter s a
to Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSepGetting Text (Path Abs Dir) String
-> ((Text -> Const Text Text) -> String -> Const Text String)
-> (Text -> Const Text Text)
-> Path Abs Dir
-> Const Text (Path Abs Dir)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(String -> Text) -> SimpleGetter String Text
forall s a. (s -> a) -> SimpleGetter s a
to String -> Text
T.pack)
  , ( String
"Extra include directories"
    , Text
"extra-include-dirs"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        Text -> [Text] -> Text
T.intercalate Text
", " ([Text] -> Text) -> (PathInfo -> [Text]) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Text) -> [String] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map String -> Text
T.pack ([String] -> [Text])
-> (PathInfo -> [String]) -> PathInfo -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Config -> [String]
configExtraIncludeDirs (Config -> [String])
-> (PathInfo -> Config) -> PathInfo -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Config PathInfo Config -> PathInfo -> Config
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Config PathInfo Config
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL )
  , ( String
"Extra library directories"
    , Text
"extra-library-dirs"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        Text -> [Text] -> Text
T.intercalate Text
", " ([Text] -> Text) -> (PathInfo -> [Text]) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Text) -> [String] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map String -> Text
T.pack ([String] -> [Text])
-> (PathInfo -> [String]) -> PathInfo -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Config -> [String]
configExtraLibDirs (Config -> [String])
-> (PathInfo -> Config) -> PathInfo -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting Config PathInfo Config -> PathInfo -> Config
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting Config PathInfo Config
forall env. HasConfig env => Lens' env Config
Lens' PathInfo Config
configL )
  , ( String
"Snapshot package database"
    , Text
"snapshot-pkg-db"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piSnapDb )
  , ( String
"Local project package database"
    , Text
"local-pkg-db"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piLocalDb )
  , ( String
"Global package database"
    , Text
"global-pkg-db"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piGlobalDb )
  , ( String
"GHC_PACKAGE_PATH environment variable"
    , Text
"ghc-package-path"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        \PathInfo
pi' -> Bool
-> Path Abs Dir
-> Path Abs Dir
-> [Path Abs Dir]
-> Path Abs Dir
-> Text
mkGhcPackagePath
                  Bool
True
                  (PathInfo -> Path Abs Dir
piLocalDb PathInfo
pi')
                  (PathInfo -> Path Abs Dir
piSnapDb PathInfo
pi')
                  (PathInfo -> [Path Abs Dir]
piExtraDbs PathInfo
pi')
                  (PathInfo -> Path Abs Dir
piGlobalDb PathInfo
pi')
    )
  , ( String
"Snapshot installation root"
    , Text
"snapshot-install-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piSnapRoot )
  , ( String
"Local project installation root"
    , Text
"local-install-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piLocalRoot )
  , ( String
"Snapshot documentation root"
    , Text
"snapshot-doc-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
UseHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        \PathInfo
pi' -> String -> Text
T.pack (Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (PathInfo -> Path Abs Dir
piSnapRoot PathInfo
pi' Path Abs Dir -> Path Rel Dir -> Path Abs Dir
forall b t. Path b Dir -> Path Rel t -> Path b t
</> Path Rel Dir
docDirSuffix))
    )
  , ( String
"Local project documentation root"
    , Text
"local-doc-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
UseHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$
        \PathInfo
pi' -> String -> Text
T.pack (Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (PathInfo -> Path Abs Dir
piLocalRoot PathInfo
pi' Path Abs Dir -> Path Rel Dir -> Path Abs Dir
forall b t. Path b Dir -> Path Rel t -> Path b t
</> Path Rel Dir
docDirSuffix))
    )
  , ( String
"Local project documentation root"
    , Text
"local-hoogle-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
UseHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piHoogleRoot)
  , ( String
"Dist work directory, relative to package directory"
    , Text
"dist-dir"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Rel Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Rel Dir -> String)
-> (PathInfo -> Path Rel Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Rel Dir
piDistDir )
  , ( String
"Where HPC reports and tix files are stored"
    , Text
"local-hpc-root"
    , (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a. a -> UseHaddocks a
WithoutHaddocks ((PathInfo -> Text) -> UseHaddocks (PathInfo -> Text))
-> (PathInfo -> Text) -> UseHaddocks (PathInfo -> Text)
forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack (String -> Text) -> (PathInfo -> String) -> PathInfo -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Abs Dir -> String
forall loc. Path loc Dir -> String
toFilePathNoTrailingSep (Path Abs Dir -> String)
-> (PathInfo -> Path Abs Dir) -> PathInfo -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathInfo -> Path Abs Dir
piHpcDir )
  ]