Skip to content

Commit 0f28a22

Browse files
Update getting started guide to use spago (#286)
* Update getting started guide to use spago * Update spago test output * Fix wording for spago test output. Co-Authored-By: Thomas Honeyman <[email protected]> Co-authored-by: Thomas Honeyman <[email protected]>
1 parent 21cdd42 commit 0f28a22

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

guides/Getting-Started.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Let's walk through the basics of getting set up to use the PureScript compiler `purs`, and its interactive mode `purs repl`.
44

5-
We'll start with the installation of the compiler and Pulp build tool, and then go through the basic usage of `purs repl`, working towards a solution of problem 1 from [Project Euler](http://projecteuler.net/problem=1).
5+
We'll start with the installation of the compiler and Spago build tool, and then go through the basic usage of `purs repl`, working towards a solution of problem 1 from [Project Euler](http://projecteuler.net/problem=1).
66

77
#### Installing the Compiler
88

@@ -16,48 +16,49 @@ The Purescript compiler (`purs`) can be installed with npm:
1616

1717
#### Setting up the Development Environment
1818

19-
PureScript's core libraries are configured to use the [Pulp](https://github.com/purescript-contrib/pulp) build tool, and packages are available in the [Bower registry](http://bower.io/search/?q=purescript-).
19+
PureScript's core libraries are configured to use the [Spago](https://github.com/spacchetti/spago) package manager and build tool.
2020

21-
If you don't have Pulp and Bower installed, install them now:
21+
If you don't have Spago installed, install it now:
2222

23-
npm install -g pulp bower
23+
npm install -g spago
2424

25-
Create a new project in an empty directory using `pulp init`:
25+
Create a new project in an empty directory using `spago init`:
2626

27-
pulp init
27+
spago init
2828

2929
Your directory should now contain the following files:
3030

31-
- `bower.json` - contains library dependency information
32-
- `bower_components/` - a directory for installed dependencies
31+
- `packages.dhall` - contains Spago configuration
32+
- `spago.dhall` - contains library dependency information
3333
- `src/Main.purs` - Entry point module for your project
3434
- `test/Main.purs` - An empty test suite
3535

3636
At this point, you should be able to build the project and run the tests:
3737

38-
pulp build
39-
pulp test
38+
spago build
39+
spago test
4040

4141
You should see output similar to the following:
4242

43-
* Building project in /Users/paf31/Documents/Code/purescript/pulp-test
44-
* Build successful. Running tests...
43+
[info] Installation complete.
44+
[info] Build succeeded.
45+
🍝
4546
You should add some tests.
46-
* Tests OK.
47-
48-
If everything was built successfully, and the tests ran without problems, then the last line should state "Tests OK".
47+
[info] Tests succeeded.
48+
49+
If everything was built successfully, and the tests ran without problems, then the last line should state "Tests succeeded."
4950

5051
#### Installing Dependencies
5152

52-
Dependencies can be installed using Bower. We will be using the `purescript-lists` library shortly, so install it now:
53+
Dependencies can be installed using Spago. We will be using the `purescript-lists` library shortly, so install it now:
5354

54-
bower install purescript-lists --save
55+
spago install lists
5556

5657
#### Working in PSCI
5758

5859
PSCi is the interactive mode of PureScript. It is useful for working with pure computations, and for testing ideas.
5960

60-
Open PSCi by typing `pulp repl` at the command line. Pulp will create a file in your directory called `.purs-repl`, which contains instructions to PSCi to load your modules and dependencies. If you invoke the PSCi executable directly, you would need to load these files by hand.
61+
Open PSCi by typing `spago repl` at the command line. Optionally, you can create a file in your directory called `.purs-repl`, which contains instructions to PSCi to load your modules and dependencies. If you invoke the PSCi executable directly, you would need to load these files by hand.
6162

6263
PSCi, version 0.12.0
6364
Type :? for help
@@ -89,10 +90,11 @@ We will use a selection of these commands during this tutorial.
8990

9091
Start by pressing the Tab key to use the autocompletion feature. You will see a collection of names of functions from the Prelude which are available to use.
9192

92-
To see the type of one of these values, first import the appropriate module using the `import` command. `pulp init` configures `.purs-repl` to install `Prelude` automatically, so you won't have to do it yourself.
93+
To see the type of one of these values, first import the appropriate module using the `import` command.
9394

9495
Next, use the `:type` command, followed by a space, followed by the name of the value:
9596

97+
> import Prelude
9698
> :type map
9799
forall a b f. Functor f => (a -> b) -> f a -> f b
98100

@@ -172,16 +174,16 @@ answer = sum multiples
172174

173175
It is possible to load this file directly into the REPL and to continue working:
174176

175-
pulp repl
177+
spago repl
176178
> import Euler
177179
> answer
178180
233168
179181
> :quit
180182
See ya!
181183

182-
Alternatively, we can use Pulp to compile our new module to JavaScript:
184+
Alternatively, we can use Spago to compile our new module to JavaScript:
183185

184-
pulp build
186+
spago build
185187

186188
This will compile each module present in `src/` into a separate file in the `output/` directory.
187189

@@ -191,7 +193,7 @@ The compiler will display several warnings about missing type declarations. In g
191193

192194
To test our code, we'll use the `purescript-assert` library:
193195

194-
bower i purescript-assert --save
196+
spago install assert
195197

196198
Modify the `test/Main.purs` file, and add the following code:
197199

@@ -209,7 +211,7 @@ main = do
209211

210212
Our "test suite" is just a single assertion that the `answer` value equals the correct integer. In a real test suite, we might use the `Effect` monad to compose multiple tests in our `main` function.
211213

212-
Run the tests using `pulp test`, and you should hopefully see "Tests OK" in the last line.
214+
Run the tests using `spago test`, and you should hopefully see "Tests OK" in the last line.
213215

214216
#### Creating Executables
215217

@@ -227,11 +229,10 @@ main = do
227229
log ("The answer is " <> show answer)
228230
```
229231

230-
The `pulp run` command can be used to compile and run the `Main` module:
232+
The `spago run` command can be used to compile and run the `Main` module:
231233

232-
> pulp run
233-
* Building project in pulp-test
234-
* Build successful.
234+
> spago run
235+
[info] Build succeeded.
235236
The answer is 233168
236237

237238
#### What Next?

0 commit comments

Comments
 (0)