diff options
author | Profpatsch <mail@profpatsch.de> | 2017-10-31 12:48:37 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2017-11-05 15:56:32 +0100 |
commit | 77648da2336b4a85bbbf33866402a775e3cbdae8 (patch) | |
tree | 2b27763855fee18ac74a69b97939176842b29229 /lib/types.nix | |
parent | 7fcd3892a93912cd444832f6289307aedc3abcbd (diff) |
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.
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/types.nix b/lib/types.nix index df141885f95..01d82d31c83 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -107,18 +107,16 @@ rec { merge = mergeEqualOption; }; - int = ints.signed; + int = mkOptionType rec { + name = "int"; + description = "signed integer"; + check = isInt; + merge = mergeOneOption; + }; # specialized subdomains of int ints = let - int = mkOptionType rec { - name = "int"; - description = "signed integer"; - check = isInt; - merge = mergeOneOption; - }; - betweenDesc = lowest: highest: "${toString lowest} and ${toString highest} (both inclusive)"; between = lowest: highest: assert lowest <= highest; @@ -153,18 +151,16 @@ rec { name = "unsignedInt"; description = "unsigned integer, meaning >=0"; }; - unsigned8 = unsign 8 256; - unsigned16 = unsign 16 65536; - unsigned32 = unsign 32 4294967296; + u8 = unsign 8 256; + u16 = unsign 16 65536; + u32 = unsign 32 4294967296; # the biggest int the nix lexer accepts is 9223372036854775808 # the smallest int the nix lexer accepts is -9223372036854775807 # unsigned64 = unsign 64 18446744073709551616; - signed = int; - signed8 = sign 8 256; - signed16 = sign 16 65536; - signed32 = sign 32 4294967296; - + s8 = sign 8 256; + s16 = sign 16 65536; + s32 = sign 32 4294967296; }; str = mkOptionType { |