Is there anything equivalent to `runhaskell`?

Hi,

With Haskell I can run an arbitrary file not necessary in a src folder with the command runhaskell. I would like to do so with Purescript. I am trying to set up a Purescript dev environment using Nix to do some Advent of Code, and I would like to run a single file, not a whole project. Is it possible? If it is, It would be nice if you could provide me a flake doing that.

Thanks

Welcome @7c78!

Check out spago script --help! I think that should have what you need.

Thank you. I will go with that.

Hi @ntwilson, I have two problems with spago script. First, it requires each script to have the module name of Main, and because there are multiple Main modules, spago build fails. So, I cannot use PureScript language server.

Second, spago script requires each module to be standalone, that is, I cannot import my other helper modules.

Please help me with that.

1 Like

I looked at the book https://github.com/purescript-contrib/purescript-book and see that the author creates a new project for each exercise. I guess it is the way to do, so I will follow it. Thank you for your support.

People on discord suggest using spago run -m, and it is what I am looking for.

2 Likes