diff --git a/nested/src/type_system/repr_tree.rs b/nested/src/type_system/repr_tree.rs index 7fa3a1c..42eac89 100644 --- a/nested/src/type_system/repr_tree.rs +++ b/nested/src/type_system/repr_tree.rs @@ -1,7 +1,7 @@ use { r3vi::view::{AnyOuterViewPort, OuterViewPort, View}, crate::{ - type_system::{TypeTerm} + type_system::{TypeTerm, Context} }, std::{ collections::HashMap, @@ -31,6 +31,14 @@ impl ReprTree { &self.type_tag } + pub fn from_char(ctx: &Arc>, c: char) -> Arc> { + let buf = r3vi::buffer::singleton::SingletonBuffer::::new(c); + ReprTree::new_leaf( + (ctx, "( Char )"), + buf.get_port().into() + ) + } + pub fn new_leaf(type_tag: impl Into, port: AnyOuterViewPort) -> Arc> { let mut tree = ReprTree::new(type_tag.into()); tree.insert_leaf(vec![].into_iter(), port);