dhall-nix-lib/Misc/throwIf.dhall

15 lines
549 B
Text

λ(nix : ../NixPrelude.dhall) →
let Function/identity =
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/Function/identity.dhall
sha256:f78b96792b459cb664f41c6119bd8897dd04353a3343521d436cd82ad71cb4d4
let throw = ./throw.dhall nix
let throwIf
: Bool → Text → ∀(a : Type) → a → a
= λ(cond : Bool) →
if cond
then λ(message : Text) → λ(a : Type) → λ(_ : a) → throw a message
else λ(msg : Text) → Function/identity
in throwIf