Add Scheme, TypeEnv, Substitution data structs

This commit is contained in:
greg 2018-06-03 00:47:29 -07:00
parent c65907388d
commit 4caf8096b3

View File

@ -1,4 +1,5 @@
use std::rc::Rc;
use std::collections::HashMap;
/*
use std::collections::{HashSet, HashMap};
use std::collections::hash_set::Union;
@ -29,6 +30,18 @@ enum TConst {
Custom(String)
}
#[derive(Debug, PartialEq, Clone)]
struct Scheme {
names: Vec<TypeName>,
ty: Type,
}
#[derive(Debug, PartialEq, Clone)]
struct Substitution(HashMap<TypeName, Type>);
#[derive(Debug, PartialEq, Clone)]
struct TypeEnv(HashMap<TypeName, Scheme>);
pub struct TypeContext<'a> {
values: StateStack<'a, TypeName, Type>
}