pub struct TypeInferenceSystem;Expand description
A bidirectional type inference system for STLC. Implements the “Check” and “Synth” modes of bidirectional typing.
Implementations§
Source§impl TypeInferenceSystem
impl TypeInferenceSystem
Sourcepub fn synthesize(&self, ctx: &Context, term: &Term) -> Option<SimpleType>
pub fn synthesize(&self, ctx: &Context, term: &Term) -> Option<SimpleType>
Synthesis mode: try to infer the type of term in context ctx.
Returns Some(ty) if successful.
Sourcepub fn check(&self, ctx: &Context, term: &Term, ty: &SimpleType) -> bool
pub fn check(&self, ctx: &Context, term: &Term, ty: &SimpleType) -> bool
Checking mode: verify that term has type ty in context ctx.
Sourcepub fn infer_with_annotation(
&self,
ctx: &Context,
term: &Term,
hint: Option<&SimpleType>,
) -> Option<SimpleType>
pub fn infer_with_annotation( &self, ctx: &Context, term: &Term, hint: Option<&SimpleType>, ) -> Option<SimpleType>
Attempt to reconstruct the type of an annotated term. A term is “annotated” if it is an application with a synthesizable function.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeInferenceSystem
impl RefUnwindSafe for TypeInferenceSystem
impl Send for TypeInferenceSystem
impl Sync for TypeInferenceSystem
impl Unpin for TypeInferenceSystem
impl UnsafeUnpin for TypeInferenceSystem
impl UnwindSafe for TypeInferenceSystem
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