pub enum TypeAnnotation {
GenericType(Ident),
Typed {
module_name: ModuleName,
name: Spanned<Ident>,
args: Vec<Spanned<TypeAnnotation>>,
},
Unit,
Tupled(Vec<Spanned<TypeAnnotation>>),
Record(Vec<Spanned<RecordField>>),
GenericRecord {
base: Spanned<Ident>,
fields: Vec<Spanned<RecordField>>,
},
FunctionType {
from: Box<Spanned<TypeAnnotation>>,
to: Box<Spanned<TypeAnnotation>>,
},
}Expand description
A type annotation in Elm source code.
Represents the syntax of types as written by the programmer, before any resolution or canonicalization.
Variants§
GenericType(Ident)
A type variable: a, msg, comparable
Typed
A named type, possibly qualified, with type arguments.
Examples:
Int→Typed { module_name: [], name: "Int", args: [] }Maybe Int→Typed { module_name: [], name: "Maybe", args: [Int] }Dict.Dict String Int→Typed { module_name: ["Dict"], name: "Dict", args: [String, Int] }
Unit
The unit type: ()
Tupled(Vec<Spanned<TypeAnnotation>>)
A tuple type: ( Int, String ) or ( Int, String, Bool )
Elm only supports 2-tuples and 3-tuples.
Record(Vec<Spanned<RecordField>>)
A record type: { name : String, age : Int }
GenericRecord
An extensible record type: { a | name : String, age : Int }
FunctionType
A function type: Int -> String
Trait Implementations§
Source§impl Clone for TypeAnnotation
impl Clone for TypeAnnotation
Source§fn clone(&self) -> TypeAnnotation
fn clone(&self) -> TypeAnnotation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypeAnnotation
impl Debug for TypeAnnotation
Source§impl Display for TypeAnnotation
impl Display for TypeAnnotation
Source§impl PartialEq for TypeAnnotation
impl PartialEq for TypeAnnotation
Source§fn eq(&self, other: &TypeAnnotation) -> bool
fn eq(&self, other: &TypeAnnotation) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for TypeAnnotation
impl StructuralPartialEq for TypeAnnotation
Auto Trait Implementations§
impl Freeze for TypeAnnotation
impl RefUnwindSafe for TypeAnnotation
impl Send for TypeAnnotation
impl Sync for TypeAnnotation
impl Unpin for TypeAnnotation
impl UnsafeUnpin for TypeAnnotation
impl UnwindSafe for TypeAnnotation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more