Various progress, doesnt compile

Added prelude, made lambdas a single-token prefix like NS, made progress on implementations, removed const line type
This commit is contained in:
2025-07-31 00:30:41 +02:00
parent 19f2c6426a
commit 769c6cfc9f
31 changed files with 450 additions and 250 deletions

View File

@@ -1,5 +1,6 @@
use std::future::Future;
use never::Never;
use orchid_base::error::{OrcErr, OrcRes, mk_err};
use orchid_base::interner::Interner;
use orchid_base::location::Pos;
@@ -7,7 +8,7 @@ use orchid_base::location::Pos;
use crate::atom::{AtomicFeatures, ToAtom, TypAtom};
use crate::expr::Expr;
use crate::gen_expr::{GExpr, atom, bot};
use crate::system::downcast_atom;
use crate::system::{SysCtx, downcast_atom};
pub trait TryFromExpr: Sized {
fn try_from_expr(expr: Expr) -> impl Future<Output = OrcRes<Self>>;
@@ -43,6 +44,10 @@ impl<A: AtomicFeatures> TryFromExpr for TypAtom<A> {
}
}
impl TryFromExpr for SysCtx {
async fn try_from_expr(expr: Expr) -> OrcRes<Self> { Ok(expr.ctx()) }
}
pub trait ToExpr {
fn to_expr(self) -> GExpr;
}
@@ -66,3 +71,7 @@ impl<T: ToExpr> ToExpr for OrcRes<T> {
impl<A: ToAtom> ToExpr for A {
fn to_expr(self) -> GExpr { atom(self) }
}
impl ToExpr for Never {
fn to_expr(self) -> GExpr { match self {} }
}