From ecb4c0f803e9b408e4fd21c475769eb4dc649d14 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 14 Mar 2021 16:43:47 -0400 Subject: Universally quantified type variables Implement universally quantified type variables, both explicitly given by the user and inferred by the type inference algorithm. --- src/ast/hir.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ast/hir.rs') 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(self, f: F) -> Result, E> where F: Fn(T) -> Result + Clone, -- cgit 1.4.1