Type type structure

This commit is contained in:
greg 2018-05-16 02:16:58 -07:00
parent 8f0104ebc7
commit 6f639b9030
1 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,5 @@
use std::rc::Rc;
use std::collections::HashMap;
use std::collections::{HashSet, HashMap};
//use std::char;
use std::fmt;
use std::fmt::Write;
@ -38,6 +38,26 @@ pub enum SymbolSpec {
/* real meat of type stuff here */
#[derive(Debug, PartialEq, Clone)]
enum MonoType {
Const(TypeConst),
Var(Rc<String>),
Function(Box<MonoType>, Box<MonoType>),
}
#[derive(Debug, PartialEq, Clone)]
enum TypeConst {
Unit,
Nat,
Int,
Float,
StringT,
Bool,
Tuple(Vec<MonoType>),
}
#[derive(Debug, PartialEq, Clone)]
struct PolyType(HashSet<Rc<String>>, MonoType);
#[derive(Debug, PartialEq, Clone)]
pub enum Type {