From f4b6589b1acb4f099cf7dbf8f012563b2e9aa522 Mon Sep 17 00:00:00 2001 From: Alexander Nutz Date: Thu, 18 Sep 2025 13:05:02 +0200 Subject: [PATCH] Update spec.md --- spec.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/spec.md b/spec.md index 8c27e89..5e307d7 100644 --- a/spec.md +++ b/spec.md @@ -91,6 +91,21 @@ type Uint8 = {...?Uint8} +## Extensible unions +The difference between these and partial unions is that many compilation units can extend one extensible union. +This means that no compilation unit can do exhaustive pattern matching + +``` +extensible union Plan + +extend Plan with 'ReadlnPlan Unit +extend Plan with 'WritelnPlan Unit + +# pattern matching against these is always non-exhaustive. +# can only pattern match against the imported extensions +``` + + ## Compatible-with Check if type is compatible-with / assignable-to type requirements. @@ -523,16 +538,6 @@ def example(li: List[Char]) -> {t:Token,rem:List[Char]} { -## Extensible unions -``` -extensible union Plan - -extend Plan with 'ReadlnPlan Unit -extend Plan with 'WritelnPlan Unit - -# pattern matching against these is always non-exhaustive. -# can only pattern match with the imported extensions -``` ## Lenses