[−][src]Enum gluon_base::types::Type
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
Hole
An unbound type _
, awaiting ascription.
Opaque
An opaque type
Error
A type used to mark type errors
Builtin(BuiltinType)
A builtin type
Forall(Vec<Generic<Id>>, T)
Universally quantified types
App(T, AppVec<T>)
A type application with multiple arguments. For example,
Map String Int
would be represented as App(Map, [String, Int])
.
Function(ArgType, T, T)
Function type which can have a explicit or implicit argument
Record(T)
Record constructor, of kind Row -> Type
Variant(T)
Variant constructor, of kind Row -> Type
Effect(T)
Effect constructor, of kind Row -> Type -> Type
EmptyRow
The empty row, of kind Row
ExtendRow
Row extension, of kind ... -> Row -> Row
Fields of ExtendRow
Ident(Id)
An identifier type. These are created during parsing, but should all be
resolved into Type::Alias
es 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.
Projection(AppVec<Id>)
Variable(TypeVariable)
An unbound type variable that may be unified with other types. These
will eventually be converted into Type::Generic
s during generalization.
Generic(Generic<Id>)
A variable that needs to be instantiated with a fresh type variable when the binding is referred to.
Alias(AliasRef<Id, T>)
Skolem(Skolem<Id>)
Methods
impl<Id, T> Type<Id, T>
[src]
pub fn as_variable(&self) -> Option<&TypeVariable>
[src]
impl<Id, T> Type<Id, T> where
T: From<Type<Id, T>>,
[src]
T: From<Type<Id, T>>,
pub fn hole() -> T
[src]
pub fn opaque() -> T
[src]
pub fn error() -> T
[src]
pub fn builtin(typ: BuiltinType) -> T
[src]
pub fn forall(params: Vec<Generic<Id>>, typ: T) -> T
[src]
pub fn array(typ: T) -> T
[src]
pub fn array_builtin() -> T
[src]
pub fn app(id: T, args: AppVec<T>) -> T
[src]
pub fn variant(fields: Vec<Field<Id, T>>) -> T
[src]
pub fn poly_variant(fields: Vec<Field<Id, T>>, rest: T) -> T
[src]
pub fn effect(fields: Vec<Field<Id, T>>) -> T
[src]
pub fn poly_effect(fields: Vec<Field<Id, T>>, rest: T) -> T
[src]
pub fn tuple<S: ?Sized, I>(symbols: &mut S, elems: I) -> T where
S: IdentEnv<Ident = Id>,
I: IntoIterator<Item = T>,
[src]
S: IdentEnv<Ident = Id>,
I: IntoIterator<Item = T>,
pub fn tuple_<S: ?Sized, I>(symbols: &mut S, elems: I) -> Type<Id, T> where
S: IdentEnv<Ident = Id>,
I: IntoIterator<Item = T>,
[src]
S: IdentEnv<Ident = Id>,
I: IntoIterator<Item = T>,
pub fn record(
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>
) -> T
[src]
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>
) -> T
pub fn poly_record(
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>,
rest: T
) -> T
[src]
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>,
rest: T
) -> T
pub fn extend_row(
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>,
rest: T
) -> T
[src]
types: Vec<Field<Id, Alias<Id, T>>>,
fields: Vec<Field<Id, T>>,
rest: T
) -> T
pub fn empty_row() -> T
[src]
pub fn function(args: Vec<T>, ret: T) -> T where
T: Clone,
[src]
T: Clone,
pub fn function_implicit<I>(args: I, ret: T) -> T where
I: IntoIterator<Item = T>,
I::IntoIter: DoubleEndedIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
I::IntoIter: DoubleEndedIterator<Item = T>,
pub fn function_type<I>(arg_type: ArgType, args: I, ret: T) -> T where
I: IntoIterator<Item = T>,
I::IntoIter: DoubleEndedIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
I::IntoIter: DoubleEndedIterator<Item = T>,
pub fn generic(typ: Generic<Id>) -> T
[src]
pub fn skolem(typ: Skolem<Id>) -> T
[src]
pub fn variable(typ: TypeVariable) -> T
[src]
pub fn alias(name: Id, args: Vec<Generic<Id>>, typ: T) -> T
[src]
pub fn ident(id: Id) -> T
[src]
pub fn projection(id: AppVec<Id>) -> T
[src]
pub fn function_builtin() -> T
[src]
pub fn string() -> T
[src]
pub fn char() -> T
[src]
pub fn byte() -> T
[src]
pub fn int() -> T
[src]
pub fn float() -> T
[src]
pub fn unit() -> T
[src]
impl<Id, T> Type<Id, T> where
T: Deref<Target = Type<Id, T>>,
[src]
T: Deref<Target = Type<Id, T>>,
pub fn as_function(&self) -> Option<(&T, &T)>
[src]
pub fn as_explicit_function(&self) -> Option<(&T, &T)>
[src]
pub fn as_function_with_type(&self) -> Option<(ArgType, &T, &T)>
[src]
pub fn unapplied_args(&self) -> Cow<[T]> where
T: Clone,
[src]
T: Clone,
pub fn alias_ident(&self) -> Option<&Id>
[src]
pub fn applied_alias(&self) -> Option<&AliasRef<Id, T>>
[src]
pub fn is_non_polymorphic_record(&self) -> bool
[src]
pub fn params(&self) -> &[Generic<Id>]
[src]
pub fn kind<'k>(&'k self, cache: &'k KindCache) -> Cow<'k, ArcKind>
[src]
impl<T> Type<Symbol, T> where
T: Deref<Target = Type<Symbol, T>>,
[src]
T: Deref<Target = Type<Symbol, T>>,
pub fn name(&self) -> Option<&SymbolRef>
[src]
Returns the name of self
Example:
Option a => Option
Int => Int
Trait Implementations
impl<Id: PartialEq, T: PartialEq> PartialEq<Type<Id, T>> for Type<Id, T>
[src]
impl<Id: Eq, T: Eq> Eq for Type<Id, T>
[src]
impl<Id: Clone, T: Clone> Clone for Type<Id, T>
[src]
fn clone(&self) -> Type<Id, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<Id> From<Type<Id, AstType<Id>>> for AstType<Id>
[src]
impl<Id> From<Type<Id, ArcType<Id>>> for ArcType<Id>
[src]
impl<Id: Hash, T: Hash> Hash for Type<Id, T>
[src]
fn hash<__HIdT: Hasher>(&self, state: &mut __HIdT)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<Id: Debug, T: Debug> Debug for Type<Id, T>
[src]
impl<Id> Borrow<Type<Id, ArcType<Id>>> for ArcType<Id>
[src]
Auto Trait Implementations
impl<Id, T> Send for Type<Id, T> where
Id: Send + Sync,
T: Send + Sync,
Id: Send + Sync,
T: Send + Sync,
impl<Id, T> Sync for Type<Id, T> where
Id: Send + Sync,
T: Send + Sync,
Id: Send + Sync,
T: Send + Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,