Skip to content

A peer-to-peer stack for code collaboration

Move 'send-code' to chain module

Thomas Scholtes22e4f786ec27
diff --git a/docs/source/reference.rst b/docs/source/reference.rst
index ce22004..fcc4360 100644
--- a/docs/source/reference.rst
+++ b/docs/source/reference.rst
@@ -786,11 +786,6 @@ Read a single radicle value from a file.
Read many radicle values from a file.
-``(send-code! chain-id filename)``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Send code from a file to a remote chain.
-
``(shell-with-stdout! command to-write)``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1092,6 +1087,11 @@ while also calling the callback on the result.
Send the pure prelude to a chain.
+``(send-code! chain-id filename)``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Send code from a file to a remote chain.
+
``prelude/state-machine``
-------------------------
diff --git a/rad/monadic/issues.rad b/rad/monadic/issues.rad
index 6b3fbf0..58aa41e 100644
--- a/rad/monadic/issues.rad
+++ b/rad/monadic/issues.rad
@@ -7,6 +7,7 @@
(load! "rad/prelude.rad")
(import prelude/lens :unqualified)
+(import prelude/chain '[send-code! ]:unqualified)
(def radicle-issues-chain-id
"The name of this chain."
diff --git a/rad/monadic/names.rad b/rad/monadic/names.rad
index 4cf59b2..1af8a32 100644
--- a/rad/monadic/names.rad
+++ b/rad/monadic/names.rad
@@ -3,7 +3,7 @@
(def create-name-chain!
(fn [url]
(chain/send-prelude! url)
- (send-code! url "rad/monadic/names-remote.rad")))
+ (chain/send-code! url "rad/monadic/names-remote.rad")))
(def lookup-key
(fn [chain-ref key]
diff --git a/rad/prelude/chain.rad b/rad/prelude/chain.rad
index 993f4f7..3c33da1 100644
--- a/rad/prelude/chain.rad
+++ b/rad/prelude/chain.rad
@@ -1,6 +1,8 @@
{:module 'prelude/chain
:doc "Functions for simulating remote chains."
- :exports '[new-chain load-chain! eval-in-chain update-chain-ref! eval updatable-eval update-chain! eval-fn-app send-prelude!]}
+ :exports '[new-chain load-chain! eval-in-chain update-chain-ref! eval
+ updatable-eval update-chain! eval-fn-app send-prelude!
+ send-code!]}
(import prelude/io '[read-file-values!] :as 'io)
(import prelude/ref '[modify-ref] :unqualified)
@@ -215,3 +217,8 @@
"Send the pure prelude to a chain."
(fn [chain-id]
(send! chain-id pure-prelude-code)))
+
+(def send-code!
+ "Send code from a file to a remote chain."
+ (fn [chain-id filename]
+ (send! chain-id (io/read-file-values! filename))))
diff --git a/rad/prelude/io.rad b/rad/prelude/io.rad
index f9f883e..8921024 100644
--- a/rad/prelude/io.rad
+++ b/rad/prelude/io.rad
@@ -1,6 +1,6 @@
{:module 'prelude/io
:doc "Some basic I/O functions."
- :exports '[print! shell! process! read-line! read-file-value! read-file-values! send-code!
+ :exports '[print! shell! process! read-line! read-file-value! read-file-values!
shell-with-stdout! shell-no-stdin! process-with-stdout! write-file!
init-file-dict! read-file-key! write-file-key! ls! modify-file!
]}
@@ -22,11 +22,6 @@
(fn [file]
(read-many-annotated file (read-file! file))))
-(def send-code!
- "Send code from a file to a remote chain."
- (fn [chain-id filename]
- (send! chain-id (read-file-values! filename))))
-
(def print!
"Print a value to the console or stdout."
(fn [x]