Skip to content

Instantly share code, notes, and snippets.

@atacratic
Last active August 25, 2018 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atacratic/99fb707a7cb96bcd714cc1c024a7e08e to your computer and use it in GitHub Desktop.
Save atacratic/99fb707a7cb96bcd714cc1c024a7e08e to your computer and use it in GitHub Desktop.
Sketch of possible breakdown of Remote API into effects
-- 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