From 6f639b9030726a070e101ba91647d8e055900418 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 16 May 2018 02:16:58 -0700 Subject: [PATCH] Type type structure --- schala-lang/src/typechecking.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/schala-lang/src/typechecking.rs b/schala-lang/src/typechecking.rs index 486a77c..467deb7 100644 --- a/schala-lang/src/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -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), + Function(Box, Box), +} + +#[derive(Debug, PartialEq, Clone)] +enum TypeConst { + Unit, + Nat, + Int, + Float, + StringT, + Bool, + Tuple(Vec), +} + +#[derive(Debug, PartialEq, Clone)] +struct PolyType(HashSet>, MonoType); #[derive(Debug, PartialEq, Clone)] pub enum Type {