Hi there
So I have installed Purescript according to the book https://book.purescript.org/
My question is about package management.
I have read @justinw posts in relation to package management but I still fail to grasp how this is handled at system level, if that makes sense.
For example, I am used to Python
Pip Install Packages (pip install
) – I can launch it from any directory and that will install the package making it accessible from anywhere. In other words, if I run pip install pandas
a bunch of stuff happens and then i can launch a repl
and import Pandas as pd
will work. Not so with Purescript… let me explain.
From what I tried it seems packages need to be reinstalled in each project directory, which needs to be init
-ed first, but I am not sure if this is intended or I am doing something wrong.
Here’s a list of what I have done and results:
1. Create project as per the book
- Navigate to my root directory (or any other directory that is NOT the project one)
spago repl
import Math
in module $PSCI
at <internal>:0:0 - 0:0 (line 0, column 0 - line 0, column 0)
Unknown module Math
Then if id try spago install math
I get:
[error] There's no "spago.dhall" in your current location.
If you already have a spago project you might be in the wrong subdirectory,
otherwise you might want to run `spago init` to initialize a new project.
2. Create project as per the book
- Navigate to project directory
spago repl
-
import Math
, throws error
in module $PSCI
at <internal>:0:0 - 0:0 (line 0, column 0 - line 0, column 0)
Unknown module Math
3. Create project as per the book
- Navigate to project directory
spago install math
spago repl
-
import Math
, looks good!
> import Math
>
What from my point of view should happen / would make sense is being able to install packages once, and use them system wide similar to pip install
.
Is it me doing something wrong or is this a not supported feature? If the latter, is it planned, and how could I contribute?
thanks!