Skip to content

Commit

Permalink
Merge pull request #10413 from 9999years/document-to-saved-config
Browse files Browse the repository at this point in the history
Add type signature and documentation to `toSavedConfig`
  • Loading branch information
mergify[bot] authored Oct 7, 2024
2 parents 67539e7 + 5a65cdd commit cc618ff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cabal-install/src/Distribution/Client/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import qualified Distribution.Deprecated.ParseUtils as ParseUtils
import Distribution.Parsec (ParsecParser, parsecFilePath, parsecOptCommaList, parsecToken)
import Distribution.Simple.Command
( CommandUI (commandOptions)
, OptionField
, ShowOrParseArgs (..)
, commandDefaultFlags
)
Expand Down Expand Up @@ -1314,6 +1315,19 @@ configFieldDescriptions src =
ParseArgs
]
where
toSavedConfig
:: (FieldDescr a -> FieldDescr SavedConfig)
-- Lifting function.
-> [OptionField a]
-- Option fields.
-> [String]
-- Fields to exclude, by name.
-> [FieldDescr a]
-- Field replacements.
--
-- If an option is found with the same name as one of these replacement
-- fields, the replacement field is used instead of the option.
-> [FieldDescr SavedConfig]
toSavedConfig lift options exclusions replacements =
[ lift (fromMaybe field replacement)
| opt <- options
Expand Down

0 comments on commit cc618ff

Please sign in to comment.