aboutsummaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-04-29 12:45:48 +0100
committertslil <tslil@posteo.de>2026-04-29 14:12:10 +0100
commitcafb3a62af10bb09f8489ba0ab07258a70a75664 (patch)
treef42ebdbd75e0f4dda97750d10e95a6d930be639a /src/ast.rs
parent651a67cb568d80e72f8c6a650b985991f4b129d8 (diff)
wire in instance checking to the main checker
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ast.rs b/src/ast.rs
index 7fcbee0..d13b2a8 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -2,7 +2,7 @@ use derive_more::Display;
// Set layer
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum BuiltIn {
Nat,
Int,
@@ -11,21 +11,21 @@ pub enum BuiltIn {
Bool,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display("{name} : {set}")]
pub struct RecordField {
pub name: String,
pub set: Set,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display("{name} : {set}")]
pub struct VariantField {
pub name: String,
pub set: Set,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Set {
#[display("{_0}")]
BuiltIn(BuiltIn),
@@ -45,21 +45,21 @@ pub enum Set {
// Signature layer
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display("({name} : {set})")]
pub struct Param {
pub name: String,
pub set: Set,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display("{name} :: {signature}")]
pub struct SigField {
pub name: String,
pub signature: Signature,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Signature {
#[display("Set")]
Set,
@@ -79,7 +79,7 @@ pub enum Signature {
// Element layer
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Literal {
Nat(u64),
Int(i64),
@@ -88,14 +88,14 @@ pub enum Literal {
Bool(bool),
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display(".{name} = {element}")]
pub struct ElemAssign {
pub name: String,
pub element: Element,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display(".{tag} {bound} => {body}")]
pub struct CaseArm {
pub tag: String,
@@ -103,7 +103,7 @@ pub struct CaseArm {
pub body: Element,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Element {
#[display("{_0}")]
Literal(Literal),
@@ -135,14 +135,14 @@ pub enum Element {
// Instance layer
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
#[display(".{name} = {instance}")]
pub struct InstAssign {
pub name: String,
pub instance: Instance,
}
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Instance {
#[display("({_0} :: Set)")]
SetCoerce(Box<Set>),
@@ -171,7 +171,7 @@ pub enum Instance {
// Declarations
-#[derive(Clone, PartialEq, Display)]
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Decl {
#[display("let set {name} = {set}")]
Set { name: String, set: Set },
@@ -194,6 +194,6 @@ pub enum Decl {
},
}
-#[derive(Display)]
+#[derive(Display, Debug)]
#[display("{}", _0.iter().map(|d| d.to_string()).collect::<Vec<_>>().join("\n"))]
pub struct Programme(pub Vec<Decl>);