mergeEqualOption
lib.options.mergeEqualOption
Docs pulled from | This Revision | 11 minutes ago
"Merge" option definitions by checking that they all have the same value.
Inputs
loc
-
1. Function argument
defs
-
2. Function argument
Noogle detected
Implementation
The following is the current implementation of this function.
mergeEqualOption = loc: defs:
if defs == [] then abort "This case should never happen."
# Return early if we only have one element
# This also makes it work for functions, because the foldl' below would try
# to compare the first element with itself, which is false for functions
else if length defs == 1 then (head defs).value
else (foldl' (first: def:
if def.value != first.value then
throw "The option `${showOption loc}' has conflicting definition values:${showDefs [ first def ]}\n${prioritySuggestion}"
else
first) (head defs) (tail defs)).value;