diff options
author | Griffin Smith <root@gws.fyi> | 2021-03-14T20·43-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2021-03-14T20·43-0400 |
commit | ecb4c0f803e9b408e4fd21c475769eb4dc649d14 (patch) | |
tree | 80390b00a6009cea21fbb68cbf56e6a193b478a2 /src/ast/hir.rs | |
parent | 7960c3270e1a338f4da40d044a6896df96d82c79 (diff) |
Universally quantified type variables
Implement universally quantified type variables, both explicitly given by the user and inferred by the type inference algorithm.
Diffstat (limited to 'src/ast/hir.rs')
-rw-r--r-- | src/ast/hir.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ast/hir.rs b/src/ast/hir.rs index 9db6919f6f53..6859174a2dd0 100644 --- a/src/ast/hir.rs +++ b/src/ast/hir.rs @@ -222,6 +222,12 @@ pub enum Decl<'a, T> { } impl<'a, T> Decl<'a, T> { + pub fn type_(&self) -> &T { + match self { + Decl::Fun { type_, .. } => type_, + } + } + pub fn traverse_type<F, U, E>(self, f: F) -> Result<Decl<'a, U>, E> where F: Fn(T) -> Result<U, E> + Clone, |