use Maybe instead of null
This commit is contained in:
parent
8b36748b94
commit
bc5fc341d5
1 changed files with 7 additions and 4 deletions
|
|
@ -95,10 +95,13 @@ with nib.types; rec {
|
||||||
# form: attrValueAt :: xs -> path -> value
|
# form: attrValueAt :: xs -> path -> value
|
||||||
# given path as a list of strings, return that value of an
|
# given path as a list of strings, return that value of an
|
||||||
# attribute set at that path
|
# attribute set at that path
|
||||||
attrValueAt = foldl (l: r:
|
attrValueAt = let
|
||||||
if l != null && hasAttr r l
|
value = foldl (l: r:
|
||||||
then l.${r}
|
if isAttrs l && hasAttr r l
|
||||||
else null);
|
then l.${r}
|
||||||
|
else null);
|
||||||
|
in
|
||||||
|
nullableToMaybe value;
|
||||||
|
|
||||||
mergeAttrsList = list: let
|
mergeAttrsList = list: let
|
||||||
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
# `binaryMerge start end` merges the elements at indices `index` of `list` such that `start <= index < end`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue