From 9d4f086a045e8a8574c7719ec1cbb60d04162162 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Feb 2019 03:36:12 -0800 Subject: [PATCH] Put mk_type! in typechecking module --- schala-lang/language/src/builtin.rs | 6 ------ schala-lang/language/src/lib.rs | 5 +++-- schala-lang/language/src/typechecking.rs | 6 ++++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/schala-lang/language/src/builtin.rs b/schala-lang/language/src/builtin.rs index 192f0cf..867cdb9 100644 --- a/schala-lang/language/src/builtin.rs +++ b/schala-lang/language/src/builtin.rs @@ -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, ())> = diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index fe71a32..d28cc22 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -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; diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 56cf24c..385ff9e 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -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.