Skip to content
Discussions/App Development/Watch, recompile and reload code in the replForum ↗

Watch, recompile and reload code in the repl

App Development3 posts211 views1 likesLast activity Jul 2023
CO
cortsfOP
Jul 2023

Hello, new damler here!

Q1: There is any way to reload modules in the repl without having to restart it?

Q2. There is any way to watch daml files for changes and recompile code automatically when using daml start? daml start takes too long to start but it’s pretty quick to recompile so it doesn’t looks ideal to wrap the command with a bash script.

A_
a_putkov
Jul 2023

Hello @cortsf and welcome to the community. I hope you enjoy learning Daml and that you continue doing so.

cortsf:

Q1: There is any way to reload modules in the repl without having to restart it?

You can add and remove modules to/from scope using :module +/- ModA ModB command in the REPL. See the documentation for more detail. But if you want to change the dar file, then to the best of my knowledge the dar file can only be passed to REPL on startup as a command line parameter, hence you can’t update the dar file loaded in REPL without restarting it.

cortsf:

Q2. There is any way to watch daml files for changes and recompile code automatically when using daml start? daml start takes too long to start but it’s pretty quick to recompile so

You can’t automatically recompile based on changes to daml files. But you can rebuild the package and reset the ledger with updated package without fully stopping and restarting the sandbox and other components. Once daml start launches all the components, you should see the message in the terminal saying “Press ‘r’ to re-build and upload the package to the sandbox. Press ‘Ctrl-C’ to quit”. Just follow the suggestion and hit ‘r’.

CO
cortsf
Jul 2023

Thanks, I was looking to re-load the dar. For recompiling the dar automatically I think I can fake the r key press with a script and hook it to the emacs save function. Not fancy but it will work :blush:

← Back to Discussions