Put mk_type! in typechecking module
This commit is contained in:
parent
e38ae1c3f1
commit
9d4f086a04
@ -86,12 +86,6 @@ impl PrefixOp {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO make this macro exportable?
|
||||
macro_rules! mk_type {
|
||||
($type_name:ident) => { Type::Const(TypeConst::$type_name) };
|
||||
($t1:ident -> $t2:ident) => { Type::Arrow(Box::new(mk_type!($t1)), Box::new(mk_type!($t2))) };
|
||||
($t1:ident -> $t2:ident -> $t3:ident) => { Type::Arrow(Box::new(mk_type!($t1)), Box::new(mk_type!($t2 -> $t3))) };
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref PREFIX_OPS: HashMap<&'static str, (Type, ())> =
|
||||
|
@ -28,13 +28,14 @@ macro_rules! bx {
|
||||
($e:expr) => { Box::new($e) }
|
||||
}
|
||||
|
||||
#[macro_use]
|
||||
mod typechecking;
|
||||
mod util;
|
||||
mod builtin;
|
||||
mod tokenizing;
|
||||
mod ast;
|
||||
mod parsing;
|
||||
mod symbol_table;
|
||||
mod typechecking;
|
||||
mod builtin;
|
||||
mod reduced_ast;
|
||||
mod eval;
|
||||
|
||||
|
@ -78,6 +78,12 @@ impl Type {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! mk_type {
|
||||
($type_name:ident) => { Type::Const(TypeConst::$type_name) };
|
||||
($t1:ident -> $t2:ident) => { Type::Arrow(Box::new(mk_type!($t1)), Box::new(mk_type!($t2))) };
|
||||
($t1:ident -> $t2:ident -> $t3:ident) => { Type::Arrow(Box::new(mk_type!($t1)), Box::new(mk_type!($t2 -> $t3))) };
|
||||
}
|
||||
|
||||
/*
|
||||
/// `Type` is parameterized by whether the type variables can be just universal, or universal or
|
||||
/// existential.
|
||||
|
Loading…
Reference in New Issue
Block a user