|
|
|
@ -119,7 +119,9 @@ rec { |
|
|
|
|
let |
|
|
|
|
betweenDesc = lowest: highest: |
|
|
|
|
"${toString lowest} and ${toString highest} (both inclusive)"; |
|
|
|
|
between = lowest: highest: assert lowest <= highest; |
|
|
|
|
between = lowest: highest: |
|
|
|
|
assert lib.assertMsg (lowest <= highest) |
|
|
|
|
"ints.between: lowest must be smaller than highest"; |
|
|
|
|
addCheck int (x: x >= lowest && x <= highest) // { |
|
|
|
|
name = "intBetween"; |
|
|
|
|
description = "integer between ${betweenDesc lowest highest}"; |
|
|
|
@ -439,7 +441,9 @@ rec { |
|
|
|
|
# Either value of type `finalType` or `coercedType`, the latter is |
|
|
|
|
# converted to `finalType` using `coerceFunc`. |
|
|
|
|
coercedTo = coercedType: coerceFunc: finalType: |
|
|
|
|
assert coercedType.getSubModules == null; |
|
|
|
|
assert assertMsg (coercedType.getSubModules == null) |
|
|
|
|
"coercedTo: coercedType must not have submodules (it’s a ${ |
|
|
|
|
coercedType.description})"; |
|
|
|
|
mkOptionType rec { |
|
|
|
|
name = "coercedTo"; |
|
|
|
|
description = "${finalType.description} or ${coercedType.description} convertible to it"; |
|
|
|
|