bahaghari/lib: update comments

This commit is contained in:
Gabriel Arazas 2024-02-24 10:30:41 +08:00
parent 0af7a31d7b
commit 6000026719
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 14 additions and 4 deletions

View File

@ -1,11 +1,12 @@
# Bahaghari's set of library. This requires nixpkgs' package set which has its # Bahaghari's set of library. This requires nixpkgs' package set which has its
# library anyways. This set is mostly copied over from nixpkgs' way of doing # library anyways. This set is mostly copied over from nixpkgs' way of doing
# things. # things.
{ pkgs }: #
# Take note the `lib` attribute throughout all of the library files are # Take note the `lib` attribute throughout all of the library files are
# referring to the Bahaghari library set. We mostly rely on `pkgs.lib` as an # referring to the Bahaghari library set. We mostly rely on `pkgs.lib` as an
# easy way to identify if we use nixpkgs' standard library. # easy way to identify if we use nixpkgs' standard library.
{ pkgs }:
pkgs.lib.makeExtensible pkgs.lib.makeExtensible
(self: (self:
let let
@ -14,6 +15,9 @@ pkgs.lib.makeExtensible
{ {
trivial = callLibs ./trivial.nix; trivial = callLibs ./trivial.nix;
hex = callLibs ./hex.nix; hex = callLibs ./hex.nix;
# Dedicated module sets are not supposed to have any of its functions as
# a top-level attribute.
tinted-theming = callLibs ./tinted-theming.nix; tinted-theming = callLibs ./tinted-theming.nix;
inherit (self.trivial) importYAML toYAML toBaseDigitsWithGlyphs; inherit (self.trivial) importYAML toYAML toBaseDigitsWithGlyphs;

View File

@ -6,6 +6,12 @@
rec { rec {
inherit (pkgs.lib.trivial) toHexString; inherit (pkgs.lib.trivial) toHexString;
# A variant of `lib.lists.range` function just with hexadecimal digits. /* A variant of `lib.lists.range` function just with hexadecimal digits.
range = first: last: builtins.map (n: toHexString n) (lib.lists.range first last);
Type: range :: Int -> Int -> [ String ]
Example:
range 15 18 => [ "F" "10" "11" ]
*/
range = first: last: builtins.map (n: toHexString n) (pkgs.lib.lists.range first last);
} }