lib/types: signed -> s, unsigned -> u, remove signed alias
Mirrors the way it’s done in modern low-level languages like Rust (by input of @nbp). Removes the signed alias for int.
This commit is contained in:
parent
7fcd3892a9
commit
77648da233
|
@ -107,18 +107,16 @@ rec {
|
||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
int = ints.signed;
|
int = mkOptionType rec {
|
||||||
|
name = "int";
|
||||||
|
description = "signed integer";
|
||||||
|
check = isInt;
|
||||||
|
merge = mergeOneOption;
|
||||||
|
};
|
||||||
|
|
||||||
# specialized subdomains of int
|
# specialized subdomains of int
|
||||||
ints =
|
ints =
|
||||||
let
|
let
|
||||||
int = mkOptionType rec {
|
|
||||||
name = "int";
|
|
||||||
description = "signed integer";
|
|
||||||
check = isInt;
|
|
||||||
merge = mergeOneOption;
|
|
||||||
};
|
|
||||||
|
|
||||||
betweenDesc = lowest: highest:
|
betweenDesc = lowest: highest:
|
||||||
"${toString lowest} and ${toString highest} (both inclusive)";
|
"${toString lowest} and ${toString highest} (both inclusive)";
|
||||||
between = lowest: highest: assert lowest <= highest;
|
between = lowest: highest: assert lowest <= highest;
|
||||||
|
@ -153,18 +151,16 @@ rec {
|
||||||
name = "unsignedInt";
|
name = "unsignedInt";
|
||||||
description = "unsigned integer, meaning >=0";
|
description = "unsigned integer, meaning >=0";
|
||||||
};
|
};
|
||||||
unsigned8 = unsign 8 256;
|
u8 = unsign 8 256;
|
||||||
unsigned16 = unsign 16 65536;
|
u16 = unsign 16 65536;
|
||||||
unsigned32 = unsign 32 4294967296;
|
u32 = unsign 32 4294967296;
|
||||||
# the biggest int the nix lexer accepts is 9223372036854775808
|
# the biggest int the nix lexer accepts is 9223372036854775808
|
||||||
# the smallest int the nix lexer accepts is -9223372036854775807
|
# the smallest int the nix lexer accepts is -9223372036854775807
|
||||||
# unsigned64 = unsign 64 18446744073709551616;
|
# unsigned64 = unsign 64 18446744073709551616;
|
||||||
|
|
||||||
signed = int;
|
s8 = sign 8 256;
|
||||||
signed8 = sign 8 256;
|
s16 = sign 16 65536;
|
||||||
signed16 = sign 16 65536;
|
s32 = sign 32 4294967296;
|
||||||
signed32 = sign 32 4294967296;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
str = mkOptionType {
|
str = mkOptionType {
|
||||||
|
|
Loading…
Reference in New Issue