[][src]Struct kontroli::Typing

pub struct Typing<T> {
    pub typ: T,
    pub term: Option<(T, Check)>,
    pub rewritable: bool,
}

Normalised, verified form of introduction commands.

An introduction command can have many shapes: x: A, x := t, x: A := t, ... A typing provides a uniform presentation of introduction commands with respect to type checking.

Fields

typ: Tterm: Option<(T, Check)>rewritable: bool

Implementations

impl<'s> Typing<RTerm<'s>>[src]

pub fn declare(
    typ: RTerm<'s>,
    rewritable: bool,
    sig: &Signature<'s>
) -> Result<Self, Error>
[src]

pub fn define(
    oty: Option<RTerm<'s>>,
    term: RTerm<'s>,
    rewritable: bool,
    sig: &Signature<'s>
) -> Result<Self, Error>
[src]

pub fn check(self, sig: &Signature<'s>) -> Result<Self, Error>[src]

Verify whether t: A if this was not previously checked.

Return a typing registering that t: A has been checked.

pub fn new(it: Intro<'s>, sig: &Signature<'s>) -> Result<Self, Error>[src]

Construct a typing from an introduction command.

An introduction command can have many shapes, such as x: A, x := t, x: A := t, ... The type A of the newly introduced symbol is (a) inferred from its defining term t if not given and (b) verified to be of a proper sort. In case a defining term t is given, t is registered, along with the information whether the type A was inferred from it.

Constructing a typing from a command of the shape x: A := t does not check whether t: A. For this, the check function can be used. This allows us to postpone and parallelise type checking.

impl<'s> Typing<RTerm<'s>>[src]

pub fn declare(
    typ: RTerm<'s>,
    rewritable: bool,
    sig: &Signature<'s>
) -> Result<Self, Error>
[src]

pub fn define(
    oty: Option<RTerm<'s>>,
    term: RTerm<'s>,
    rewritable: bool,
    sig: &Signature<'s>
) -> Result<Self, Error>
[src]

pub fn check(self, sig: &Signature<'s>) -> Result<Self, Error>[src]

Verify whether t: A if this was not previously checked.

Return a typing registering that t: A has been checked.

pub fn new(it: Intro<'s>, sig: &Signature<'s>) -> Result<Self, Error>[src]

Construct a typing from an introduction command.

An introduction command can have many shapes, such as x: A, x := t, x: A := t, ... The type A of the newly introduced symbol is (a) inferred from its defining term t if not given and (b) verified to be of a proper sort. In case a defining term t is given, t is registered, along with the information whether the type A was inferred from it.

Constructing a typing from a command of the shape x: A := t does not check whether t: A. For this, the check function can be used. This allows us to postpone and parallelise type checking.

Trait Implementations

impl<T: Clone> Clone for Typing<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Typing<T> where
    T: RefUnwindSafe

impl<T> Send for Typing<T> where
    T: Send

impl<T> Sync for Typing<T> where
    T: Sync

impl<T> Unpin for Typing<T> where
    T: Unpin

impl<T> UnwindSafe for Typing<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.