15 lines
434 B
Text
15 lines
434 B
Text
λ(nix : ../NixPrelude.dhall) →
|
|
let Any = ../Any/Type.dhall
|
|
|
|
let Integer/nonNegative = ../Integer/nonNegative.dhall
|
|
|
|
let Misc/throw = ../Misc/throw.dhall nix
|
|
|
|
let Integer/fromAny = ../Integer/fromAny.dhall nix
|
|
|
|
in λ(v : Any) →
|
|
let int = Integer/fromAny v
|
|
|
|
in if Integer/nonNegative int
|
|
then Integer/clamp int
|
|
else Misc/throw Natural "Failed to coerce object into Natural"
|