docs: migrate lib.bools to doc-comments

This commit is contained in:
KFears 2025-09-14 18:02:35 +04:00
parent 58c7465dc2
commit abc36668eb
Signed by: KFearsoff
SSH key fingerprint: SHA256:sn39ts1xvi/KGQNlqDyrj8nNlhp9ilndgIolXKnPraw

View file

@ -1,46 +1,64 @@
lib: {
into = {
## Convert a boolean value into a string.
##
## @type Bool -> String
/**
Convert a boolean value into a string.
*/
string = value: if value then "true" else "false";
## Convert a boolean into either the string "yes" or "no".
##
## @type Bool -> String
/**
Convert a boolean into the string "yes" or "no".
*/
yesno = value: if value then "yes" else "no";
};
## Choose between two values based on a condition. When true, the first value
## is returned, otherwise the second value is returned.
##
## @type Bool -> a -> b -> a | b
/**
Choose between two values based on a condition. When true, the first value
is returned, otherwise the second value is returned.
# Type
```
when :: Bool -> a -> b -> a | b
```
*/
when =
condition: x: y:
if condition then x else y;
## Perform a logical AND operation on two values.
##
## @type Bool -> Bool -> Bool
/**
Perform a logical AND operation on two values.
*/
and = a: b: a && b;
## Perform a logical AND operation on two functions being applied to a value.
##
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
/**
Perform a logical AND operation on two functions being applied to a value.
# Type
```
and :: (a -> Bool) -> (a -> Bool) -> a -> Bool
```
*/
and' = f: g: (x: (f x) && (g x));
## Perform a logical OR operation on two values.
##
## @type Bool -> Bool -> Bool
/**
Perform a logical OR operation on two values.
*/
or = a: b: a || b;
## Perform a logical OR operation on two functions being applied to a value.
##
## @type (a -> Bool) -> (a -> Bool) -> a -> Bool
/**
Perform a logical OR operation on two functions being applied to a value.
# Type
```
or' :: (a -> Bool) -> (a -> Bool) -> a -> Bool
```
*/
or' = f: g: (x: (f x) || (g x));
## Perform a logical NOT operation on a value.
##
## @type Bool -> Bool
/**
Perform a logical NOT operation on two values.
*/
not = a: !a;
}