Created
June 3, 2024 13:07
-
-
Save ceedubs/871e3095215d10a69097d546625d0675 to your computer and use it in GitHub Desktop.
Unison custom partial ability handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleRemoteCustom : '{g, Remote} r -> {g, Remote} r | |
handleRemoteCustom = | |
go : forall r. '{g, Remote} r -> {g, Remote} r | |
go thunk = handle !thunk with cases | |
{ r } -> r | |
{ time.now! -> k } -> | |
res = todo "what do you want to do for time?" | |
go '(k res) | |
{ Promise.tryWrite x y -> k } -> | |
res = Promise.tryWrite x y | |
go '(k res) | |
{ Ref.tryDelete x -> k } -> | |
res = Ref.tryDelete x | |
go '(k res) | |
{ Remote.fail x -> k } -> | |
res = Remote.fail x | |
go '(k res) | |
{ detached! -> k } -> | |
res = detached! | |
go '(k res) | |
{ here! -> k } -> | |
res = here! | |
go '(k res) | |
{ region! -> k } -> | |
res = region! | |
go '(k res) | |
{ addFinalizer x -> k } -> | |
res = addFinalizer x | |
go '(k res) | |
{ detached x -> k } -> | |
res = detached x | |
go '(k res) | |
{ Remote.Promise.tryRead x -> k } -> | |
res = Remote.Promise.tryRead x | |
go '(k res) | |
{ Remote.sleepMicroseconds x -> k } -> | |
res = Remote.sleepMicroseconds x | |
go '(k res) | |
{ Ref.tryWrite x y -> k } -> | |
res = Ref.tryWrite x y | |
go '(k res) | |
{ tryScope x -> k } -> | |
res = tryScope x | |
go '(k res) | |
{ tryNear x y -> k } -> | |
res = tryNear x y | |
go '(k res) | |
{ tryFar x y -> k } -> | |
res = tryFar x y | |
go '(k res) | |
{ allowCancel! -> k } -> | |
res = allowCancel! | |
go '(k res) | |
{ tryCas x y z -> k } -> | |
res = tryCas x y z | |
go '(k res) | |
{ monotonic! -> k } -> | |
res = monotonic! | |
go '(k res) | |
{ tryCancel x -> k } -> | |
res = tryCancel x | |
go '(k res) | |
{ Promise.tryDelete x -> k } -> | |
res = Promise.tryDelete x | |
go '(k res) | |
{ tryReadForCas x -> k } -> | |
res = tryReadForCas x | |
go '(k res) | |
{ tryReadNow x -> k } -> | |
res = tryReadNow x | |
go '(k res) | |
{ tryDetachAt x y -> k } -> | |
res = tryDetachAt x y | |
go '(k res) | |
{ Remote.randomBytes x -> k } -> | |
res = Remote.randomBytes x | |
go '(k res) | |
go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment