purenix icon indicating copy to clipboard operation
purenix copied to clipboard

Add support for --run

Open jonascarpay opened this issue 1 year ago • 2 comments

Initial attempt at #56.

  • Argument handling is provisional; it just checks if the argument list is of the form --run <str>, and if so, tries to run the test.
  • Running the test means parsing into a module name and function name, and then calling nix-instantiate --eval -E "(import ./<moduleName>).<functionName>".
    • @considerate In your example, you pass null. Why is that?
  • I split the Main module into Main.Build and Main.Run.

jonascarpay avatar May 07 '23 02:05 jonascarpay

In the example I pass null to run the Effect. I think inspecting whether it’s a function and calling the function with null would be a strategy that could work.

considerate avatar May 07 '23 02:05 considerate

For reference, spago always runs the main function and calls it without any argument (equivalent to calling with null in purenix) for the JS backend.

considerate avatar May 08 '23 04:05 considerate