pub struct TypeEraser { /* private fields */ }Expand description
Performs type erasure on kernel expressions.
Implementations§
Source§impl TypeEraser
impl TypeEraser
Sourcepub fn with_config(config: EraseConfig) -> Self
pub fn with_config(config: EraseConfig) -> Self
Create a type eraser with a custom configuration.
Sourcepub fn erase_sort(&self) -> ErasedExpr
pub fn erase_sort(&self) -> ErasedExpr
Erase a sort (universe level) — always becomes TypeErased.
Sourcepub fn erase_pi(&self) -> ErasedExpr
pub fn erase_pi(&self) -> ErasedExpr
Erase a Pi-type — types are always erased to TypeErased.
Sourcepub fn erase_lam_body(&self, body: ErasedExpr) -> ErasedExpr
pub fn erase_lam_body(&self, body: ErasedExpr) -> ErasedExpr
Wrap a lambda body in a Lam node (type annotation already dropped).
Sourcepub fn erase_app(f: ErasedExpr, arg: ErasedExpr) -> ErasedExpr
pub fn erase_app(f: ErasedExpr, arg: ErasedExpr) -> ErasedExpr
Build an erased application from an already-erased function and argument.
Sourcepub fn erase_lit(n: u64) -> ErasedExpr
pub fn erase_lit(n: u64) -> ErasedExpr
Erase a natural-number literal.
Sourcepub fn optimize(&self, expr: ErasedExpr) -> ErasedExpr
pub fn optimize(&self, expr: ErasedExpr) -> ErasedExpr
Optimise an erased expression by beta-reducing TypeErased applications.
When the function position of an App is TypeErased, the whole
application is also TypeErased (the argument is a type). This
recursively simplifies the tree.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeEraser
impl RefUnwindSafe for TypeEraser
impl Send for TypeEraser
impl Sync for TypeEraser
impl Unpin for TypeEraser
impl UnsafeUnpin for TypeEraser
impl UnwindSafe for TypeEraser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more