51 lines
1.5 KiB
Text
51 lines
1.5 KiB
Text
λ(nix : ../NixPrelude.dhall) →
|
|
let Any = ../Any/Type.dhall
|
|
|
|
let Set = ../Set/Type.dhall
|
|
|
|
let Any/toAny = ../Any/toAny.dhall nix
|
|
|
|
let Any/toTypeUnchecked = ../Any/toTypeUnchecked.dhall nix
|
|
|
|
let fixp = (./fix.dhall nix).fixp
|
|
|
|
let Set/toSet = ../Set/toSet.dhall nix
|
|
|
|
let Set/mergeAttrs = ../Set/mergeAttrs.dhall nix
|
|
|
|
let extends = ./extends.dhall nix
|
|
|
|
let FunctionType = λ(x : Type) → x → Text → (Set → Set) → Set
|
|
|
|
let function =
|
|
λ(function : FunctionType Any) →
|
|
let functionArgs =
|
|
Any/toTypeUnchecked
|
|
(FunctionType (FunctionType Any))
|
|
(Any/toAny (FunctionType Any) function)
|
|
function
|
|
|
|
in λ(extenderName : Text) →
|
|
λ(rattrs : Set → Set) →
|
|
let extset =
|
|
Set/toSet
|
|
((Set → Set → Set) → Set)
|
|
[ { mapKey = extenderName
|
|
, mapValue =
|
|
λ(f : Set → Set → Set) →
|
|
functionArgs extenderName (extends f rattrs)
|
|
}
|
|
]
|
|
|
|
in Set/mergeAttrs (fixp rattrs) extset
|
|
|
|
let functionErased =
|
|
Any/toTypeUnchecked
|
|
(FunctionType Any)
|
|
(Any/toAny (FunctionType (FunctionType Any)) function)
|
|
|
|
let makeExtensibleWithCustomName
|
|
: Text → (Set → Set) → Set
|
|
= function functionErased
|
|
|
|
in makeExtensibleWithCustomName
|