summaryrefslogtreecommitdiff
path: root/examples/03-sum/src/shapes.hob
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-31 10:50:10 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-31 10:50:10 +0100
commit578bf1f04b48f48225cfa794a27426cca4f6384a (patch)
treefc5c2737ffa65e20305f165a593111463a36166d /examples/03-sum/src/shapes.hob
parent1831d27671abe87bcbea5da40517093c37efb9b7 (diff)
Support singleton structs
Diffstat (limited to 'examples/03-sum/src/shapes.hob')
-rw-r--r--examples/03-sum/src/shapes.hob17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/03-sum/src/shapes.hob b/examples/03-sum/src/shapes.hob
new file mode 100644
index 0000000..03a727a
--- /dev/null
+++ b/examples/03-sum/src/shapes.hob
@@ -0,0 +1,17 @@
+/// A 2D shape.
+sum Shape {
+ variant Rectangle;
+ variant Triangle;
+
+ field width: Int32;
+}
+
+struct Rectangle {
+ field width: Int32;
+ field height: Int32;
+}
+
+struct Triangle {
+ field width: Int32;
+ field height: Int32;
+}