dhall-nix-lib/Bool/fromAny.dhall
2022-08-31 15:59:38 +01:00

11 lines
336 B
Text

λ(nix : ../NixPrelude.dhall) →
let Any = ../Any/Type.dhall
let Any/toTypeUnchecked = ../Any/toTypeUnchecked.dhall nix
let Misc/throw = ../Misc/throw.dhall nix
in λ(v : Any) →
if nix.builtins.isBool v
then Any/toTypeUnchecked Bool v
else Misc/throw Bool "Failed to coerce object into Bool"