From 60000267199c89573217a4350ef37fde642af229 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 24 Feb 2024 10:30:41 +0800 Subject: [PATCH] bahaghari/lib: update comments --- subprojects/bahaghari/lib/default.nix | 8 ++++++-- subprojects/bahaghari/lib/hex.nix | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/subprojects/bahaghari/lib/default.nix b/subprojects/bahaghari/lib/default.nix index 22569468..c75face3 100644 --- a/subprojects/bahaghari/lib/default.nix +++ b/subprojects/bahaghari/lib/default.nix @@ -1,11 +1,12 @@ # 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 # things. -{ pkgs }: - +# # 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 # easy way to identify if we use nixpkgs' standard library. +{ pkgs }: + pkgs.lib.makeExtensible (self: let @@ -14,6 +15,9 @@ pkgs.lib.makeExtensible { trivial = callLibs ./trivial.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; inherit (self.trivial) importYAML toYAML toBaseDigitsWithGlyphs; diff --git a/subprojects/bahaghari/lib/hex.nix b/subprojects/bahaghari/lib/hex.nix index 3873866e..499b4883 100644 --- a/subprojects/bahaghari/lib/hex.nix +++ b/subprojects/bahaghari/lib/hex.nix @@ -6,6 +6,12 @@ rec { inherit (pkgs.lib.trivial) toHexString; - # A variant of `lib.lists.range` function just with hexadecimal digits. - range = first: last: builtins.map (n: toHexString n) (lib.lists.range first last); + /* A variant of `lib.lists.range` function just with hexadecimal digits. + + 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); }