dhall-nix-lib/Function/fix.dhall

23 lines
641 B
Text
Raw Normal View History

2022-09-09 07:23:27 +00:00
λ(nix : ../NixPrelude.dhall) →
let fixSrc = "f: let x = f x; in x"
let fixSrcp = "f: let x = f x // { __unfix__ = f; }; in x"
let fixFile = nix.builtins.toFile "fix.nix" fixSrc
let fixFilep = nix.builtins.toFile "fix.nix" fixSrcp
let Any/toTypeUnchecked = ../Any/toTypeUnchecked.dhall nix
let fix
: ∀(t : Type) → (t → t) → t
= λ(t : Type) →
Any/toTypeUnchecked ((t → t) → t) (nix.builtins.import fixFile)
let fixp
: ∀(t : Type) → (t → t) → t
= λ(t : Type) →
Any/toTypeUnchecked ((t → t) → t) (nix.builtins.import fixFilep)
in { fix, fixp }