I am trying to setup hello world project with purescript on NixOs and have couple questions,
- Official
purescriptwebsite recommend installation vianpmbut there is nonixos.nodePackages.purescript, instead there are at least 2 variants I found innixpkgs- nixos.purescript
- nixos.haskellPackages.purescript
What are the different?
- Official site recommend
pulpandbowervianpmbut onlynodePackages.boweris avaliable and there is undocumentedpsc-package.
What should be the nix way to handle purescript packages?
- The sample code on official site (see
hello.pursbellow) doesn't even compile,
with these error.
$ purs compile hello.purs
Error found:
at hello.purs line 1, column 1 - line 1, column 1
Unable to parse module:
unexpected "import"
expecting "module"
I add module Hello to code but still failed.
$ purs compile hello.purs
Error 1 of 2:
in module Hello
at hello.purs line 2, column 1 - line 2, column 15
Module Prelude was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Hello
at hello.purs line 3, column 1 - line 3, column 39
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
How the correct workflow should be?
The goal is to have minimal example project with a single hello.purs
running in web browser.
This is hello.purs
module Hello where
import Prelude
import Control.Monad.Eff.Console (log)
greet :: String -> String
greet name = "Hello, " <> name <> "!"
main = log (greet "World")
It would be really helpful if you can also provide shell.nix for nix-shell or default.nix for nix-build.
Found this 2 years old guild, I am trying it but I still not have answer to all of my questions.
npm install pulp- the binary will be installed tonode_modules/.bin/pulpbower install purescript-prelude purescript-console.But
node_modules/.bin/pulp initwill give you a Bower file and you can runbower installto give you a basic project. You can then donode_modules/.bin/pulp runto execute it using node.js, but you'll probably wantpulp browserify --to example.jsto get a file you can put in a<script>tag in HTML.