aboutsummaryrefslogtreecommitdiff
path: root/stdlib.slip
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-23 00:08:11 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-23 00:08:11 +0300
commit32fb9b036575c8b25a5318c7bce7699249990ff5 (patch)
treecb1fd7d5c30eb338ef4312115a0b9d6dbda677f5 /stdlib.slip
parent12a7cbf8ef911f0cbfcbd13d1c888025fa411de4 (diff)
downloadmyslip-32fb9b036575c8b25a5318c7bce7699249990ff5.tar.gz
myslip-32fb9b036575c8b25a5318c7bce7699249990ff5.zip
feat: left-or and right-or for coproducts in stdlib
Diffstat (limited to 'stdlib.slip')
-rw-r--r--stdlib.slip20
1 files changed, 20 insertions, 0 deletions
diff --git a/stdlib.slip b/stdlib.slip
index f3c1d47..dcedafc 100644
--- a/stdlib.slip
+++ b/stdlib.slip
@@ -65,3 +65,23 @@
)
)
))
+
+
+(let left-or
+ (fn (sum def) ((Sum L R) L) L
+ (case sum
+ ((inl x) x)
+ (_ def))
+ )
+)
+
+
+(let right-or
+ (fn (sum def) ((Sum L R) R) R
+ (case sum
+ ((inr x) x)
+ (_ def))
+ )
+)
+
+