commercialhaskell / rio

A standard library for Haskell
Other
838 stars 54 forks source link

Export a generalised version of `augmentPathMap` (as `augmentPathMap'`) #242

Closed mpilgrem closed 2 years ago

mpilgrem commented 2 years ago

Existing RIO.Process.augmentPathMap is specialised to the PATH environment variable. There are other environment variables commonly used to contain lists of paths (eg PKG_CONFIG_PATH) and it would be helpful to be able to augment them in the same way. This pull request proposes to extend the API by providing the generalised:

augmentPathMap' :: Text -> [FilePath] -> EnvVars -> Either ProcessException EnvVars

Existing augmentPathMap then is defined as augmentPathMap = augmentPathMap' "PATH".

augmentPath is not specialised to PATH or any other environment variable. This pull request improves its Haddock documentation to clarify that (1) it augments the value of any environment variable assumed to list paths, and (2) it does not check that the existing value lists paths.