pub struct Telescope {
pub binders: Vec<(Name, Expr)>,
}Expand description
A telescope is a sequence of (name, type) binders, where later types may depend on earlier names.
This is the standard way to represent the argument list of a function
type (x₁ : T₁) → (x₂ : T₂[x₁]) → … → B.
Fields§
§binders: Vec<(Name, Expr)>Binders in order from outermost to innermost.
Implementations§
Source§impl Telescope
impl Telescope
Sourcepub fn from_pi(expr: &Expr) -> (Self, Expr)
pub fn from_pi(expr: &Expr) -> (Self, Expr)
Extract the telescope from a Pi type.
telescope_of(Pi(x: A, Pi(y: B, C))) returns [(x, A), (y, B)] and body C.
Sourcepub fn to_pi(&self, body: Expr) -> Expr
pub fn to_pi(&self, body: Expr) -> Expr
Reconstruct the Pi type from this telescope and a body.
Sourcepub fn instantiate(&self, args: &[Expr]) -> Vec<Expr>
pub fn instantiate(&self, args: &[Expr]) -> Vec<Expr>
Instantiate the telescope with a list of expressions.
Returns the types with de Bruijn indices resolved.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Telescope
impl RefUnwindSafe for Telescope
impl Send for Telescope
impl Sync for Telescope
impl Unpin for Telescope
impl UnsafeUnpin for Telescope
impl UnwindSafe for Telescope
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