Skip to content

Commit

Permalink
Update tps' build instructions for 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Dec 11, 2023
1 parent aad93d7 commit 596bc32
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
bin
dist-newstyle
slides/*.java
slides/Course*.hs
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ But I've never done it.

### Development instruction

These instructions are more [hermetic](https://bazel.build/basics/hermeticity) than
the ones in [tps](./tps/README.md). This is intentional. If you are here to do the _travaux pratiques_,
use the instructions in [tps](./tps/README.md).

- The Haskell compiler (GHC) is installed in an isolated manner, in `bin/ghc` (see below)
- This requires [ghcup](https://www.haskell.org/ghcup) in `PATH` and that's all
- When started from this directory, the [vscode Haskell extension](https://github.com/haskell/vscode-haskell)
Expand Down
37 changes: 24 additions & 13 deletions tps/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# This is the home of the TPs for the functional programming course of Telecom Nancy

To reproduce a working environment:
To reproduce a working environment, from the repository root, do:

* Install the Haskell installer with [ghcup](https://www.haskell.org/ghcup/):
`curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh`
This will ask questions:
- Answer `P` to update your `PATH` automatically.
- Answer `Y` to install IDE tooling (`haskell-language-server`).
- Answer `N` to install `stack`, since this project uses the simpler `cabal` build tool
- Answer `N` to install `stack`, since this project uses the simpler
[cabal](https://www.haskell.org/cabal/) build tool

Once it's done, run `ghcup install ghc 8.10.7` and then `ghcup set ghc 8.10.7`
Once it's done, run `ghcup install ghc 9.4.7` and then `ghcup set ghc 9.4.7`
to set the expected compiler version.
* Run `cabal build`
* Then install [vscode](https://code.visualstudio.com/) and the
* Run `cabal build all`. This will take a while as this repository depends on a number
of fat libraries. Brew some coffee meanwhile.

At this point, everything should be set to work on the command line, for example try:

```shell
cabal run -v0 TP4.hs
```

You should get as output:

```
pyEval "1 + 3" returned: 4
```

Now you can continue with the IDE configuration:

* Install [vscode](https://code.visualstudio.com/) and the
[Haskell extension](https://marketplace.visualstudio.com/items?itemName=haskell.haskell).
* Launch `vscode` **from the terminal** (`code . &`), **from this repository's root**.
If `vscode` asks you to install the Haskell Language Server, say yes.
* Happy Haskell hacking! To experiment, hack in one of the `TP*.hs` files;
see the first line for how to execute them.

This project has a weird configuration to support multiple `Main` entry points.
That is why, if you add a file on your own, you need to update the `hie.yaml` file
(akin to a `.project` in Eclipse terms or an IDEA specification). To do this:

* `cabal install implicit-hie`
* `mv hie.yaml hie.yaml.backup`
* `gen-hie > hie.yaml`
10 changes: 0 additions & 10 deletions tps/hie.yaml

This file was deleted.

0 comments on commit 596bc32

Please sign in to comment.