Change name of monad in which type inference happens

This commit is contained in:
greg 2018-11-07 17:01:07 -08:00
parent fab3fb8ec2
commit 65c47c20fc
1 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ pub struct TypeContext {
}
type TypeResult<T> = Result<T, TypeError>;
type InferResult<T> = Result<T, TypeError>;
#[derive(Debug, Clone)]
struct TypeError { }
@ -56,7 +56,7 @@ impl TypeContext {
}
impl TypeContext {
fn infer_ast(&mut self, ast: &AST) -> TypeResult<MonoType> {
fn infer_ast(&mut self, ast: &AST) -> InferResult<MonoType> {
let mut output = MonoType::Const(TConst::Unit);
for statement in ast.0.iter() {
output = match statement {
@ -67,18 +67,18 @@ impl TypeContext {
Ok(output)
}
fn infer_expr(&mut self, expr: &Expression) -> TypeResult<MonoType> {
fn infer_expr(&mut self, expr: &Expression) -> InferResult<MonoType> {
match expr {
Expression(expr_type, Some(type_anno)) => unimplemented!(),
Expression(expr_type, None) => self.infer_expr_type(expr_type)
}
}
fn infer_decl(&mut self, expr: &Declaration) -> TypeResult<MonoType> {
fn infer_decl(&mut self, expr: &Declaration) -> InferResult<MonoType> {
Ok(MonoType::Const(TConst::user("unimplemented")))
}
fn infer_expr_type(&mut self, expr_type: &ExpressionType) -> TypeResult<MonoType> {
fn infer_expr_type(&mut self, expr_type: &ExpressionType) -> InferResult<MonoType> {
use self::ExpressionType::*;
match expr_type {
NatLiteral(_) => Ok(MonoType::Const(TConst::Nat)),