[][src]Enum voile::syntax::core::Val

pub enum Val {
    Type(Level),
    Lam(Closure),
    Dt(DtKindBox<Self>, Closure),
    Sum(Variants),
    Cons(StringBox<Self>),
    Pair(Box<Self>, Box<Self>),
    Neut(Neutral),
}

Non-redex, canonical values.

Variants

Type(Level)

Type universe.

Lam(Closure)

Closure with parameter typed. For untyped closures, it can be represented as Neut directly.

Dt(DtKindBox<Self>, Closure)

Pi-like types (dependent types), with parameter explicitly typed.

Sum(Variants)

Sum type literal.

Cons(StringBox<Self>)

Constructor invocation.

Pair(Box<Self>, Box<Self>)

Sigma instance.

Neut(Neutral)

Neutral value means irreducible but not canonical values.

Methods

impl Val[src]

pub fn apply(self, arg: Val) -> Val[src]

$$ \newcommand{\inst}[0]{\texttt{inst}} \newcommand{\app}[0]{\texttt{app}} \begin{alignedat}{1} \app(\lambda C, o) &= \inst(C, o) \\ \app([k], o) &= [k\ o] \end{alignedat} $$ For evaluation during beta-reduction.

pub fn apply_borrow(self, arg: &Val) -> Val[src]

pub fn first(self) -> Val[src]

$$ \newcommand{\first}[0]{\texttt{first}} \newcommand{\second}[0]{\texttt{second}} \begin{alignedat}{1} \first(n, m) &= n \\ \first([k]) &= [k\ .1] \\ \end{alignedat} $$ For evaluation during beta-reduction.

pub fn second(self) -> Val[src]

$$ \newcommand{\first}[0]{\texttt{first}} \newcommand{\second}[0]{\texttt{second}} \begin{alignedat}{1} \second(n, m) &= m \\ \second([k]) &= [k\ .2] \end{alignedat} $$ For evaluation during beta-reduction.

pub(crate) fn attach_dbi(self, dbi: DBI) -> Self[src]

impl Val[src]

pub fn is_type(&self) -> bool[src]

pub fn is_universe(&self) -> bool[src]

pub fn try_into_sum(self) -> Result<Variants, Self>[src]

pub fn pair(first: Self, second: Self) -> Self[src]

pub fn cons(name: String, param: Self) -> Self[src]

pub fn lift(levels: u32, expr: Neutral) -> Self[src]

pub fn meta(index: MI) -> Self[src]

pub fn var(index: DBI) -> Self[src]

pub fn lam(body: Self) -> Self[src]

pub fn bot() -> TVal[src]

pub fn glob(index: GI) -> Self[src]

pub fn fresh_axiom() -> Self[src]

pub(crate) fn postulate(uid: UID) -> Self[src]

pub(crate) fn generate(uid: UID, dbi: DBI) -> Self[src]

pub fn fresh_unimplemented(index: GI) -> Self[src]

pub fn app(function: Neutral, args: Vec<Self>) -> Self[src]

pub fn fst(pair: Neutral) -> Self[src]

pub fn snd(pair: Neutral) -> Self[src]

pub fn dependent_type(kind: DtKind, param_type: TVal, body: TVal) -> TVal[src]

pub fn pi(param_type: TVal, body: TVal) -> TVal[src]

pub fn sig(param_type: TVal, body: TVal) -> TVal[src]

pub fn into_neutral(self) -> Result<Neutral, Self>[src]

pub fn map_neutral(self, f: &mut impl FnMut(Neutral) -> Self) -> Self[src]

Traverse through the AST and change all Neutral values.

pub fn try_map_neutral<R>(
    self,
    f: &mut impl FnMut(Neutral) -> Result<Self, R>
) -> Result<Self, R>
[src]

Traverse through the AST and change all Neutral values.

pub fn map_axiom(self, f: &mut impl FnMut(Axiom) -> Neutral) -> Self[src]

pub fn generated_to_var(self) -> Self[src]

pub fn unimplemented_to_glob(self) -> Self[src]

pub fn fold_neutral<R, F: Fn(R, Neutral) -> R + Copy>(self, init: R, f: F) -> R[src]

Traverse through the AST in a stateful manner.

pub fn try_fold_neutral<E, R, F: Fn(R, Neutral) -> Result<R, E> + Copy>(
    self,
    init: R,
    f: F
) -> Result<R, E>
[src]

Traverse through the AST with possible error.

impl Val[src]

pub fn into_info(self, syntax_info: SyntaxInfo) -> ValInfo[src]

Trait Implementations

impl RedEx for Val[src]

impl LiftEx for Val[src]

fn level(&self) -> Level[src]

Calculate the level of self, like a normal value will have level 0, a type expression will have level 1 (or higher). Read more

impl PartialEq<Val> for Val[src]

impl Eq for Val[src]

impl Default for Val[src]

impl Clone for Val[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Val[src]

impl Display for Val[src]

Auto Trait Implementations

impl Send for Val

impl Unpin for Val

impl Sync for Val

impl UnwindSafe for Val

impl RefUnwindSafe for Val

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]