Last active
August 25, 2018 22:09
-
-
Save atacratic/99fb707a7cb96bcd714cc1c024a7e08e to your computer and use it in GitHub Desktop.
Sketch of possible breakdown of Remote API into effects
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
-- using https://github.com/unisonweb/unison | |
-- source https://github.com/unisonweb/unison/issues/144 | |
effect Abort where | |
Abort : () -> {Abort} a | |
effect Remote where | |
here : {Remote} Node | |
transfer : Node -> {Remote} () | |
effect Tasks where | |
fork : 'a -> {Tasks} Task | |
stop : Cause -> Task -> {Tasks} Unit | |
supervise : Task -> {Tasks} ('Cause) -- parens needed around ('Cause) for the moment - see delay_parse.uu | |
effect Nodes where | |
spawn_sandboxed : Sandbox -> {Tasks} Node | |
spawn_sandboxed' : Key -> Sandbox -> {Tasks} Node | |
spawn : {Tasks} Node | |
spawn' : Key -> {Tasks} Node | |
effect Boxes where | |
empty : {Boxes} (Box a) -- parens needed around (Box a) for the moment - similarly in a few places below | |
put : a -> Box a -> {Boxes} () | |
take : Box a -> {Boxes} a | |
read : Box a -> {Boxes} a | |
access : Box a -> {Boxes} (Optional a, a -> {Boxes} Bool) | |
effect Names where | |
make : {Names} (Name a) | |
resolve : Name a -> {Names} (Box a) | |
effect Durables where | |
store : a -> {Durables} (Durable a) | |
load : Durable a -> {Durables} (Optional a) -- not in the version in #144 | |
effect Durables' a where -- worth separating from the core persistence effects in Durables? Are these even primitives? | |
sync_from : Node -> Durable a -> {Durables'} Bool | |
load_from : Node -> Durable a -> {Durables'} (Optional a) | |
peers : Durable a -> {Durables'} (Vector Node) | |
effect Foreign a where | |
ask : Foreign a -> {Foreign} (Optional a) -- note name clash between effect and type - problem? | |
effect Crypto a where -- maybe not primitive if you have Random and Foreign | |
encrypt : Key -> a -> {Crypto} (Encrypted a) | |
decrypt : Key -> Encrypted a -> {Crypto} (Either DecryptionFailure a) | |
AES256_key : {Crypto} Key | |
Blowfish_key : {Crypto} Key | |
effect Sleep where | |
sleep : Duration -> {Sleep} () | |
() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment