feat: add map2, map3, andThen to Astrid.Query
This commit is contained in:
parent
3cf23637d5
commit
b6182376b6
12 changed files with 1202 additions and 1018 deletions
|
|
@ -1,8 +1,8 @@
|
|||
use crate::elm;
|
||||
use crate::reporting::{CompilerError, Problem, TypeError};
|
||||
use genco::lang::rust;
|
||||
use genco::quote_in;
|
||||
use genco::tokens::quoted;
|
||||
use genco::{quote, quote_in};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::PathBuf;
|
||||
use tracing::info_span;
|
||||
|
|
@ -124,7 +124,7 @@ pub fn transpile(
|
|||
);
|
||||
}
|
||||
}
|
||||
elmi::Node::DefineTailFunc(arg_names, expr, _deps) => {
|
||||
elmi::Node::DefineTailFunc(_arg_names, _expr, _deps) => {
|
||||
println!("found tail func {}", key);
|
||||
}
|
||||
_ => {
|
||||
|
|
@ -178,10 +178,10 @@ pub fn transpile(
|
|||
}
|
||||
println!("total symbols {}", objects.len());
|
||||
//let visited: HashSet<Global> = HashSet::new();
|
||||
for (key, node) in objects.iter() {
|
||||
for (_key, node) in objects.iter() {
|
||||
//println!("key {}", key);
|
||||
match node {
|
||||
elmi::Node::Define(expr, deps) => {
|
||||
elmi::Node::Define(_expr, deps) => {
|
||||
//println!("key => {:?}", expr);
|
||||
for dep in deps.iter() {
|
||||
if !objects.contains_key(&dep) {
|
||||
|
|
@ -498,7 +498,7 @@ fn codegen_expr(tokens: &mut rust::Tokens, symbol_table: &mut SymbolTable, expr:
|
|||
}
|
||||
}
|
||||
}
|
||||
elmi::Expr::Function(parameters, body) => {
|
||||
elmi::Expr::Function(_parameters, _body) => {
|
||||
quote_in! { *tokens =>
|
||||
"i don't know how to code gen a function expression"
|
||||
//#(for elmi::Name(ref parameter) in parameters.iter() join (, ) =>
|
||||
|
|
@ -509,7 +509,7 @@ fn codegen_expr(tokens: &mut rust::Tokens, symbol_table: &mut SymbolTable, expr:
|
|||
match &**fexpr {
|
||||
elmi::Expr::VarGlobal(global @ elmi::Global(home, name)) => {
|
||||
match symbol_table.get(&Symbol::Global(global)) {
|
||||
Some(SymbolKind::Function { arity, tipe }) => {
|
||||
Some(SymbolKind::Function { arity, tipe: _ }) => {
|
||||
if args.len() < *arity {
|
||||
let mut closure_args = Vec::new();
|
||||
for i in 0..(*arity - args.len()) {
|
||||
|
|
@ -542,7 +542,7 @@ fn codegen_expr(tokens: &mut rust::Tokens, symbol_table: &mut SymbolTable, expr:
|
|||
}
|
||||
//println!("found the function symbol {}, arity {}", global, arity);
|
||||
}
|
||||
Some(SymbolKind::Value { tipe }) => {
|
||||
Some(SymbolKind::Value { tipe: _ }) => {
|
||||
panic!("tried to call a symbol we thought was a value: {}", global);
|
||||
}
|
||||
None => {
|
||||
|
|
@ -571,7 +571,7 @@ fn codegen_expr(tokens: &mut rust::Tokens, symbol_table: &mut SymbolTable, expr:
|
|||
};
|
||||
}
|
||||
//elmi::Expr::TailCall(Name, Vec<(Name, Expr)>),
|
||||
elmi::Expr::If(branches, final_branch) => {
|
||||
elmi::Expr::If(branches, _final_branch) => {
|
||||
quote_in! { *tokens =>
|
||||
#(for (condition, expr) in branches join (#<push>#("} else")) =>
|
||||
if #(ref out => codegen_expr(out, symbol_table, condition)) #("{")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue