Add Scheme, TypeEnv, Substitution data structs
This commit is contained in:
parent
c65907388d
commit
4caf8096b3
@ -1,4 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::collections::HashMap;
|
||||||
/*
|
/*
|
||||||
use std::collections::{HashSet, HashMap};
|
use std::collections::{HashSet, HashMap};
|
||||||
use std::collections::hash_set::Union;
|
use std::collections::hash_set::Union;
|
||||||
@ -29,6 +30,18 @@ enum TConst {
|
|||||||
Custom(String)
|
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> {
|
pub struct TypeContext<'a> {
|
||||||
values: StateStack<'a, TypeName, Type>
|
values: StateStack<'a, TypeName, Type>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user