lean4-htt/tests/lean/lcnfTypes.lean.expected.out
Henrik Böving 52b1b342ab
feat: zero cost BaseIO (#10625)
This PR implements zero cost `BaseIO` by erasing the `IO.RealWorld`
parameter from argument lists and structures. This is a **major breaking
change for FFI**.

Concretely:
- `BaseIO` is defined in terms of `ST IO.RealWorld`
- `EIO` (and thus `IO`) is defined in terms of `EST IO.RealWorld`
- The opaque `Void` type is introduced and the trivial structure
optimization updated to account for it. Furthermore, arguments of type
`Void s` are removed from the argument lists of the C functions.
- `ST` is redefined as `Void s -> ST.Out s a` where `ST.Out` is a pair
of `Void s` and `a`

This together has the following major effects on our generated code:
- Functions that return `BaseIO`/`ST`/`EIO`/`IO`/`EST` now do not take
the dummy world parameter anymore. To account for this FFI code needs to
delete the dummy world parameter from the argument lists.
- Functions that return `BaseIO`/`ST` now return their wrapped value
directly. In particular `BaseIO UInt32` now returns a `uint32_t` instead
of a `lean_object*`. To account for this FFI code might have to change
the return type and does not need to call `lean_io_result_mk_ok` anymore
but can instead just `return` values right away (same with extracting
values from `BaseIO` computations.
- Functions that return `EIO`/`IO`/`EST` now only return the equivalent
of an `Except` node which reduces the allocation size. The
`lean_io_result_mk_ok`/`lean_io_result_mk_error` functions were updated
to account for this already so no change is required.

Besides improving performance by dropping allocation (sizes) we can now
also do fun new things such as:
```lean
@[extern "malloc"]
opaque malloc (size : USize) : BaseIO USize
```
2025-10-22 10:55:12 +02:00

52 lines
3.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Vec.zip : {α : Type u_1} → {n : Nat} → {β : Type u_2} → Vec α lcAny → Vec β lcAny → Vec (α × β) lcAny
mkConstTuple : {α : Type u_1} → α → Nat → lcAny
Fin.add : {n : Nat} → Fin lcAny → Fin lcAny → Fin lcAny
Vec.cons : {α : Type u} → {n : Nat} → α → Vec α lcAny → Vec α lcAny
Eq.rec : {α : Sort u_1} → {a : α} → {motive : α → ◾ → Sort u} → motive lcAny lcAny → {a : α} → ◾ → motive lcAny lcAny
GetElem.getElem : {coll : Type u} →
{idx : Type v} →
{elem : Type w} → {valid : coll → idx → Prop} → [self : GetElem coll idx elem ◾] → coll → idx → ◾ → elem
Term.constFold : {ctx : List Ty} → {ty : Ty} → _root_.Term lcAny lcAny → _root_.Term lcAny lcAny
Term.denote : {ctx : List Ty} → {ty : Ty} → _root_.Term lcAny lcAny → HList lcAny lcAny → lcAny
HList.get : {α : Type u_1} → {β : α → Type u_2} → {is : List α} → {i : α} → HList β lcAny → Member lcAny lcAny → β lcAny
Member.head : {α : Type u_1} → {a : α} → {as : List α} → Member lcAny lcAny
Ty.denote : Ty → Type
MonadControl.liftWith : {m : Type u → Type v} →
{n : Type u → Type w} → [self : MonadControl m n] → {α : Type u} → (({β : Type u} → n β → m lcAny) → m α) → n α
MonadControl.restoreM : {m : Type u → Type v} → {n : Type u → Type w} → [self : MonadControl m n] → {α : Type u} → m lcAny → n α
Decidable.casesOn : {p : Prop} → {motive : Decidable ◾ → Sort u} → Decidable ◾ → (◾ → motive lcAny) → (◾ → motive lcAny) → motive lcAny
Lean.getConstInfo : {m : Type → Type} → [Monad m] → [MonadEnv m] → [MonadError m] → Name → m ConstantInfo
Lean.Meta.instMonadMetaM : Monad fun α =>
Context → ST.Ref lcAny State → Core.Context → ST.Ref lcAny Core.State → lcVoid → EST.Out Exception lcAny α
Lean.Meta.inferType : Expr → Context → ST.Ref lcAny State → Core.Context → ST.Ref lcAny Core.State → lcVoid → EST.Out Exception lcAny Expr
Lean.Elab.Term.elabTerm : Syntax →
Option Expr →
Bool →
Bool →
Elab.Term.Context →
ST.Ref lcAny Elab.Term.State →
Context →
ST.Ref lcAny State → Core.Context → ST.Ref lcAny Core.State → lcVoid → EST.Out Exception lcAny Expr
Nat.add : Nat → Nat → Nat
Magma.mul : Magma → lcAny → lcAny → lcAny
weird1 : Bool → lcAny
lamAny₁ : Bool → Monad fun α => lcAny
lamAny₂ : Bool → Monad lcAny
Term.constFold : {ctx : List Ty} → {ty : Ty} → _root_.Term lcAny lcAny → _root_.Term lcAny lcAny
Term.denote : {ctx : List Ty} → {ty : Ty} → _root_.Term lcAny lcAny → HList Ty lcAny lcAny → lcAny
HList.get : {α β : lcErased} → {is : List lcAny} → {i : lcAny} → HList lcAny lcAny lcAny → Member lcAny lcAny lcAny → lcAny
Member.head : {α : lcErased} → {a : lcAny} → {as : List lcAny} → Member lcAny lcAny lcAny
Ty.denote : lcErased
MonadControl.liftWith : {m n : lcErased} →
[self : MonadControl lcAny lcAny] → {α : lcErased} → (({β : lcErased} → lcAny → lcAny) → lcAny) → lcAny
MonadControl.restoreM : {m n : lcErased} → [self : MonadControl lcAny lcAny] → {α : lcErased} → lcAny → lcAny
Decidable.casesOn : {p motive : lcErased} → Bool → (lcErased → lcAny) → (lcErased → lcAny) → lcAny
Lean.getConstInfo : {m : lcErased} → [Monad lcAny] → [MonadEnv lcAny] → [MonadError lcAny] → Name → lcAny
Lean.Meta.instMonadMetaM : Monad lcAny
Lean.Meta.inferType : Expr → Context → lcAny → Core.Context → lcAny → lcVoid → EST.Out Exception lcAny Expr
Lean.Elab.Term.elabTerm : Syntax →
Option Expr →
Bool →
Bool → Elab.Term.Context → lcAny → Context → lcAny → Core.Context → lcAny → lcVoid → EST.Out Exception lcAny Expr
Nat.add : Nat → Nat → Nat
Fin.add : {n : Nat} → Nat → Nat → Nat