[−][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
An unbound type _
, awaiting ascription.
An opaque type
A type used to mark type errors
Builtin(BuiltinType)
A builtin type
Forall(T::Generics, T)
Universally quantified types
App(T, T::Types)
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 constructor, of kind Row -> Type
Variant constructor, of kind Row -> Type
Effect constructor, of kind Row -> Type -> Type
The empty row, of kind Row
Row extension, of kind ... -> Row -> Row
Fields of ExtendRow
Row extension, of kind ... -> Row -> Row
Fields of ExtendTypeRow
Ident(KindedIdent<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>)
Implementations
impl<Id, T> Type<Id, T> where
T: TypePtr<Id = Id>,
[src]
T: TypePtr<Id = Id>,
pub fn as_variable(&self) -> Option<&TypeVariable>
[src]
impl<Id, T> Type<Id, T> where
T: From<Type<Id, T>> + TypeExt<Id = Id>,
T::Types: Default + Extend<T>,
[src]
T: From<Type<Id, T>> + TypeExt<Id = Id>,
T::Types: Default + Extend<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: T::Types) -> T
[src]
pub fn variant(fields: Vec<Field<T::SpannedId, T>>) -> T
[src]
pub fn poly_variant(fields: Vec<Field<T::SpannedId, T>>, rest: T) -> T
[src]
pub fn effect(fields: Vec<Field<T::SpannedId, T>>) -> T
[src]
pub fn poly_effect(fields: Vec<Field<T::SpannedId, T>>, rest: T) -> T
[src]
pub fn tuple<S: ?Sized, I>(symbols: &mut S, elems: I) -> T where
S: IdentEnv<Ident = Id>,
T::SpannedId: From<Id>,
I: IntoIterator<Item = T>,
T: From<(Type<Id, T>, Flags)>,
[src]
S: IdentEnv<Ident = Id>,
T::SpannedId: From<Id>,
I: IntoIterator<Item = T>,
T: From<(Type<Id, T>, Flags)>,
pub fn tuple_<S: ?Sized, I>(symbols: &mut S, elems: I) -> Type<Id, T> where
S: IdentEnv<Ident = Id>,
T::SpannedId: From<Id>,
I: IntoIterator<Item = T>,
T: From<(Type<Id, T>, Flags)>,
[src]
S: IdentEnv<Ident = Id>,
T::SpannedId: From<Id>,
I: IntoIterator<Item = T>,
T: From<(Type<Id, T>, Flags)>,
pub fn record(
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>
) -> T
[src]
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>
) -> T
pub fn poly_record(
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>,
rest: T
) -> T
[src]
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>,
rest: T
) -> T
pub fn extend_full_row(
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>,
rest: T
) -> T
[src]
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
fields: Vec<Field<T::SpannedId, T>>,
rest: T
) -> T
pub fn extend_row(fields: Vec<Field<T::SpannedId, T>>, rest: T) -> T
[src]
pub fn extend_type_row(
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
rest: T
) -> T
[src]
types: Vec<Field<T::SpannedId, Alias<Id, T>>>,
rest: T
) -> T
pub fn empty_row() -> T
[src]
pub fn function<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_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 alias_implicit(
name: Id,
args: Vec<Generic<Id>>,
typ: T,
is_implicit: bool
) -> T
[src]
name: Id,
args: Vec<Generic<Id>>,
typ: T,
is_implicit: bool
) -> T
pub fn ident(id: KindedIdent<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: TypePtr<Id = Id>,
[src]
T: TypePtr<Id = Id>,
pub fn is_array(&self) -> bool
[src]
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: TypePtr<Id = Symbol>,
[src]
T: TypePtr<Id = Symbol>,
pub fn name(&self) -> Option<&SymbolRef>
[src]
Returns the name of self
Example:
Option a => Option
Int => Int
pub fn owned_name(&self) -> Option<SymbolKey>
[src]
Trait Implementations
impl<'ast, Id, T: TypePtr<Id = Id>> AstClone<'ast, Id> for Type<Id, T> where
Id: AstClone<'ast, Id>,
T: AstClone<'ast, Id>,
T::Generics: AstClone<'ast, Id>,
T::Types: AstClone<'ast, Id>,
T::Fields: AstClone<'ast, Id>,
T::TypeFields: AstClone<'ast, Id>,
Id: Clone,
[src]
Id: AstClone<'ast, Id>,
T: AstClone<'ast, Id>,
T::Generics: AstClone<'ast, Id>,
T::Types: AstClone<'ast, Id>,
T::Fields: AstClone<'ast, Id>,
T::TypeFields: AstClone<'ast, Id>,
Id: Clone,
impl<Id> Borrow<Type<Id, ArcType<Id>>> for ArcType<Id>
[src]
impl<Id: Clone, T: Clone + TypePtr<Id = Id>> Clone for Type<Id, T> where
T::Generics: Clone,
T::Types: Clone,
T::Fields: Clone,
T::TypeFields: Clone,
[src]
T::Generics: Clone,
T::Types: Clone,
T::Fields: Clone,
T::TypeFields: Clone,
impl<Id: Debug, T: Debug + TypePtr<Id = Id>> Debug for Type<Id, T> where
T::Generics: Debug,
T::Types: Debug,
T::Fields: Debug,
T::TypeFields: Debug,
[src]
T::Generics: Debug,
T::Types: Debug,
T::Fields: Debug,
T::TypeFields: Debug,
impl<Id, T> Default for Type<Id, T> where
T: TypePtr<Id = Id>,
[src]
T: TypePtr<Id = Id>,
impl<Id: Eq, T: Eq + TypePtr<Id = Id>> Eq for Type<Id, T> where
T::Generics: Eq,
T::Types: Eq,
T::Fields: Eq,
T::TypeFields: Eq,
[src]
T::Generics: Eq,
T::Types: Eq,
T::Fields: Eq,
T::TypeFields: Eq,
impl<Id> From<Type<Id, ArcType<Id>>> for ArcType<Id> where
Id: PartialEq,
[src]
Id: PartialEq,
impl<Id: Hash, T: Hash + TypePtr<Id = Id>> Hash for Type<Id, T> where
T::Generics: Hash,
T::Types: Hash,
T::Fields: Hash,
T::TypeFields: Hash,
[src]
T::Generics: Hash,
T::Types: Hash,
T::Fields: Hash,
T::TypeFields: Hash,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<Id: PartialEq, T: PartialEq + TypePtr<Id = Id>> PartialEq<Type<Id, T>> for Type<Id, T> where
T::Generics: PartialEq,
T::Types: PartialEq,
T::Fields: PartialEq,
T::TypeFields: PartialEq,
[src]
T::Generics: PartialEq,
T::Types: PartialEq,
T::Fields: PartialEq,
T::TypeFields: PartialEq,
impl<Id, T: TypePtr<Id = Id>> StructuralEq for Type<Id, T>
[src]
impl<Id, T: TypePtr<Id = Id>> StructuralPartialEq for Type<Id, T>
[src]
Auto Trait Implementations
impl<Id, T> RefUnwindSafe for Type<Id, T> where
Id: RefUnwindSafe,
T: RefUnwindSafe,
<T as TypePtr>::Fields: RefUnwindSafe,
<T as TypePtr>::Generics: RefUnwindSafe,
<T as TypePtr>::TypeFields: RefUnwindSafe,
<T as TypePtr>::Types: RefUnwindSafe,
Id: RefUnwindSafe,
T: RefUnwindSafe,
<T as TypePtr>::Fields: RefUnwindSafe,
<T as TypePtr>::Generics: RefUnwindSafe,
<T as TypePtr>::TypeFields: RefUnwindSafe,
<T as TypePtr>::Types: RefUnwindSafe,
impl<Id, T> Send for Type<Id, T> where
Id: Send + Sync,
T: Send + Sync,
<T as TypePtr>::Fields: Send,
<T as TypePtr>::Generics: Send + Sync,
<T as TypePtr>::TypeFields: Send,
<T as TypePtr>::Types: Send,
Id: Send + Sync,
T: Send + Sync,
<T as TypePtr>::Fields: Send,
<T as TypePtr>::Generics: Send + Sync,
<T as TypePtr>::TypeFields: Send,
<T as TypePtr>::Types: Send,
impl<Id, T> Sync for Type<Id, T> where
Id: Send + Sync,
T: Send + Sync,
<T as TypePtr>::Fields: Sync,
<T as TypePtr>::Generics: Send + Sync,
<T as TypePtr>::TypeFields: Sync,
<T as TypePtr>::Types: Sync,
Id: Send + Sync,
T: Send + Sync,
<T as TypePtr>::Fields: Sync,
<T as TypePtr>::Generics: Send + Sync,
<T as TypePtr>::TypeFields: Sync,
<T as TypePtr>::Types: Sync,
impl<Id, T> Unpin for Type<Id, T> where
Id: Unpin,
T: Unpin,
<T as TypePtr>::Fields: Unpin,
<T as TypePtr>::Generics: Unpin,
<T as TypePtr>::TypeFields: Unpin,
<T as TypePtr>::Types: Unpin,
Id: Unpin,
T: Unpin,
<T as TypePtr>::Fields: Unpin,
<T as TypePtr>::Generics: Unpin,
<T as TypePtr>::TypeFields: Unpin,
<T as TypePtr>::Types: Unpin,
impl<Id, T> UnwindSafe for Type<Id, T> where
Id: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
<T as TypePtr>::Fields: UnwindSafe,
<T as TypePtr>::Generics: RefUnwindSafe + UnwindSafe,
<T as TypePtr>::TypeFields: UnwindSafe,
<T as TypePtr>::Types: UnwindSafe,
Id: RefUnwindSafe + UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
<T as TypePtr>::Fields: UnwindSafe,
<T as TypePtr>::Generics: RefUnwindSafe + UnwindSafe,
<T as TypePtr>::TypeFields: UnwindSafe,
<T as TypePtr>::Types: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Id> AsId<Id> for Id where
Id: ?Sized,
[src]
Id: ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,