From 5a0a5b8bfca141e7641efd79c2fa5b2e3cb6f4ed Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 9 Dec 2018 20:05:13 -0400 Subject: WIP: Session recursion. --- stdlib/source/lux/concurrency/session.lux | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'stdlib') diff --git a/stdlib/source/lux/concurrency/session.lux b/stdlib/source/lux/concurrency/session.lux index d4f1d6591..8f896a905 100644 --- a/stdlib/source/lux/concurrency/session.lux +++ b/stdlib/source/lux/concurrency/session.lux @@ -9,7 +9,7 @@ [collection ["." list ("list/." Functor)]]] ["." io] - [type (#+ :share)] + ["." type (#+ :share)] ["." macro ["." code] ["s" syntax (#+ syntax:) @@ -186,3 +186,23 @@ [$join /\ Join Fork ..join] [$fork \/ Fork Join ..fork] ) + +(def: #export ($rec scope) + (-> (-> Session Session) + Session) + (case (type (All $recur [_] + (:~ ($session (scope [$recur $recur]))))) + (^multi (#.UnivQ _env $scope) + [(type.flatten-tuple $scope) + (^ (list mine yours))]) + [(#.UnivQ _env mine) (#.UnivQ _env yours)] + + _ + (undefined))) + +(def: #export (rec scope) + (All [session] + (-> (-> session + session) + session)) + (scope (rec scope))) -- cgit v1.2.3