I am trying to setup hello world
project with purescript
on NixOs
and have couple questions,
purescript
website recommend installation via npm
but there is no nixos.nodePackages.purescript
, instead there are at least 2 variants I found in nixpkgs
What are the different?
pulp
and bower
via npm
but only nodePackages.bower
is avaliable and there is undocumented psc-package
.What should be the nix
way to handle purescript packages?
hello.purs
bellow) 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 to node_modules/.bin/pulp
bower install purescript-prelude purescript-console
.But node_modules/.bin/pulp init
will give you a Bower file and you can run bower install
to give you a basic project. You can then do node_modules/.bin/pulp run
to execute it using node.js, but you'll probably want pulp browserify --to example.js
to get a file you can put in a <script>
tag in HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With