use Maybe instead of null

This commit is contained in:
Emile Clark-Boman 2025-12-14 18:55:26 +10:00
parent 8b36748b94
commit bc5fc341d5

View file

@ -95,10 +95,13 @@ with nib.types; rec {
# form: attrValueAt :: xs -> path -> value
# given path as a list of strings, return that value of an
# attribute set at that path
attrValueAt = foldl (l: r:
if l != null && hasAttr r l
then l.${r}
else null);
attrValueAt = let
value = foldl (l: r:
if isAttrs l && hasAttr r l
then l.${r}
else null);
in
nullableToMaybe value;
mergeAttrsList = list: let
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`