dhall-nix-lib/Any/toFunction.dhall

17 lines
409 B
Text

λ(nix : ../NixPrelude.dhall) →
let Any = ./Type.dhall
let Function/const = ../Function/const.dhall
let isFunction = ./isFunction.dhall nix
let toTypeUnchecked = ./toTypeUnchecked.dhall nix
let toFunction
: Any → Any → Any
= λ(v : Any) →
if isFunction v
then toTypeUnchecked (Any → Any) v
else Function/const Any v Any
in toFunction