dhall-nix-lib/Any/selectOptional.dhall

10 lines
262 B
Text

λ(nix : ../NixPrelude.dhall) →
let Any = ./Type.dhall
let Any/select = ./select.dhall nix
let Any/hasAttr = ./hasAttr.dhall nix
in λ(e : Any) →
λ(attr : Text) →
if Any/hasAttr e attr then Some (Any/select e attr) else None Any