From 0f7efe7518b925d9688dad4c6f6e87f84015e2c1 Mon Sep 17 00:00:00 2001 From: tslil Date: Thu, 30 Apr 2026 16:53:14 +0100 Subject: wip case for instances --- src/ast.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/ast.rs') diff --git a/src/ast.rs b/src/ast.rs index d13b2a8..24d5b9b 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -142,6 +142,14 @@ pub struct InstAssign { pub instance: Instance, } +#[derive(Clone, PartialEq, Display, Debug)] +#[display(".{tag} {bound} => {body}")] +pub struct InstCaseArm { + pub tag: String, + pub bound: String, + pub body: Instance, +} + #[derive(Clone, PartialEq, Display, Debug)] pub enum Instance { #[display("({_0} :: Set)")] @@ -167,6 +175,12 @@ pub enum Instance { instance: Box, field: String, }, + + #[display("case {} of {{ {} }}", scrutinee, arms.iter().map(|a| a.to_string()).collect::>().join(" | "))] + Case { + scrutinee: Box, + arms: Vec, + }, } // Declarations -- cgit v1.3.1