Enum gluon_base::types::Type[][src]

pub enum Type<Id, T = ArcType<Id>> {
    Hole,
    Opaque,
    Builtin(BuiltinType),
    Forall(Vec<Generic<Id>>, T, Option<Vec<T>>),
    App(T, AppVec<T>),
    Function(ArgType, T, T),
    Record(T),
    Variant(T),
    EmptyRow,
    ExtendRow {
        types: Vec<Field<Id, Alias<Id, T>>>,
        fields: Vec<Field<Id, T>>,
        rest: T,
    },
    Ident(Id),
    Variable(TypeVariable),
    Generic(Generic<Id>),
    Alias(AliasRef<Id, T>),
    Skolem(Skolem<Id>),
}

The representation of gluon's types.

For efficiency this enum is not stored directly but instead a pointer wrapper which derefs to Type is used to enable types to be shared. It is recommended to use the static functions on Type such as Type::app and Type::record when constructing types as those will construct the pointer wrapper directly.

Variants

An unbound type _, awaiting ascription.

An opaque type

A builtin type

Universally quantified types

A type application with multiple arguments. For example, Map String Int would be represented as App(Map, [String, Int]).

Function type which can have a explicit or implicit argument

Record constructor, of kind Row -> Type

Variant constructor, of kind Row -> Type

The empty row, of kind Row

Row extension, of kind ... -> Row -> Row

Fields of ExtendRow

The associated types of this record type

The fields of this record type

The rest of the row

An identifier type. These are created during parsing, but should all be resolved into Type::Aliases during type checking.

Identifiers are also sometimes used inside aliased types to avoid cycles in reference counted pointers. This is a bit of a wart at the moment and may cause spurious unification failures.

An unbound type variable that may be unified with other types. These will eventually be converted into Type::Generics during generalization.

A variable that needs to be instantiated with a fresh type variable when the binding is referred to.

Methods

impl<Id, T> Type<Id, T>
[src]

impl<Id, T> Type<Id, T> where
    T: From<Type<Id, T>>, 
[src]

impl<Id, T> Type<Id, T> where
    T: Deref<Target = Type<Id, T>>, 
[src]

Important traits for &'a [u8]

impl<T> Type<Symbol, T> where
    T: Deref<Target = Type<Symbol, T>>, 
[src]

Returns the name of self Example: Option a => Option Int => Int

Trait Implementations

impl<Id> From<Type<Id, AstType<Id>>> for AstType<Id>
[src]

Performs the conversion.

impl<Id: Clone, T: Clone> Clone for Type<Id, T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Id: Debug, T: Debug> Debug for Type<Id, T>
[src]

Formats the value using the given formatter. Read more

impl<Id: Eq, T: Eq> Eq for Type<Id, T>
[src]

impl<Id: PartialEq, T: PartialEq> PartialEq for Type<Id, T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<Id: Hash, T: Hash> Hash for Type<Id, T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<Id> From<Type<Id, ArcType<Id>>> for ArcType<Id>
[src]

Performs the conversion.

Auto Trait Implementations

impl<Id, T> Send for Type<Id, T> where
    Id: Send + Sync,
    T: Send + Sync

impl<Id, T> Sync for Type<Id, T> where
    Id: Send + Sync,
    T: Send + Sync