38 lines
1.2 KiB
Text
38 lines
1.2 KiB
Text
λ(nix : ../NixPrelude.dhall) →
|
|
let Any = ../Any/Type.dhall
|
|
|
|
let Optional/fold =
|
|
https://raw.githubusercontent.com/dhall-lang/dhall-lang/v22.0.0/Prelude/Optional/fold.dhall
|
|
sha256:c5b9d72f6f62bdaa0e196ac1c742cc175cd67a717b880fb8aec1333a5a4132cf
|
|
|
|
let Any/toAny = ../Any/toAny.dhall nix
|
|
|
|
let Any/toTypeUnchecked = ../Any/toTypeUnchecked.dhall nix
|
|
|
|
let Any/selectOptional = ../Any/selectOptional.dhall nix
|
|
|
|
let FunctionType = λ(x : Type) → x → Any → Bool
|
|
|
|
let function =
|
|
λ(function : FunctionType Any) →
|
|
let functionArgs =
|
|
Any/toTypeUnchecked
|
|
(FunctionType (FunctionType Any))
|
|
(Any/toAny (FunctionType Any) function)
|
|
function
|
|
|
|
in λ(v : Any) →
|
|
nix.builtins.isFunction v
|
|
|| Optional/fold
|
|
Any
|
|
(Any/selectOptional v "__functor")
|
|
Bool
|
|
(λ(v : Any) → functionArgs v)
|
|
False
|
|
|
|
let functionErased =
|
|
Any/toTypeUnchecked
|
|
(FunctionType Any)
|
|
(Any/toAny (FunctionType (FunctionType Any)) function)
|
|
|
|
in function functionErased
|