Skip to content

Commit 11ef247

Browse files
authored
Add a README file (#2)
* Add README.md * Add CI badge
1 parent 50c1f96 commit 11ef247

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Andreas Herrmann
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# todo app
2+
3+
![](https://github.com/aherrmann/example_servant_elm_bazel/workflows/CI/badge.svg)
4+
5+
A minimal todo app implemented in [Haskell][haskell] using [Servant][servant]
6+
on the backend, and in [Elm][elm] on the frontend, built with [Bazel][bazel]
7+
using [`rules_haskell`][rules_haskell] and [`rules_elm`][rules_elm].
8+
9+
[haskell]: https://www.haskell.org/
10+
[servant]: https://hackage.haskell.org/package/servant
11+
[elm]: https://elm-lang.org/
12+
[bazel]: https://bazel.build/
13+
[rules_haskell]: https://haskell.build/
14+
[rules_elm]: https://github.com/EdSchouten/rules_elm
15+
16+
## Requirements
17+
18+
You will need the [dependencies of `rules_haskell`][dependencies]
19+
installed on your system to build.
20+
21+
On MacOS you also need to set the following environment variable:
22+
23+
```
24+
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
25+
```
26+
27+
[dependencies]: https://rules-haskell.readthedocs.io/en/latest/haskell.html#before-you-begin
28+
29+
## Instructions
30+
31+
Execute the following command to build and start the app:
32+
33+
```
34+
$ bazel run //:backend
35+
```
36+
37+
Then browse to `http://localhost:8080` to use the app.
38+
39+
## Interactive Development
40+
41+
You can use [`bazel-watcher`][bazel-watcher] to continuously rebuild the
42+
frontend whenever any of its sources change, like so.
43+
44+
```
45+
$ ibazel build //frontend
46+
```
47+
48+
You can use [`ghcid`][ghcid] to continuously reload the backend whenever
49+
any of its sources change, like so.
50+
51+
```
52+
$ ghcid --command="bazel run //backend:backend@ghci" \
53+
--test=Main.main \
54+
--setup=":set args --assets bazel-bin/frontend/frontend.tar" \
55+
--reload=bazel-bin/frontend/frontend.tar
56+
```
57+
58+
This will load the Haskell code into a GHCi session and run the server in
59+
the interpreter. It will reload the session and restart the server
60+
whenever any of the Haskell source files or the frontend bundle changes.
61+
62+
Note, if the dependency graph changes, e.g. when you edit a `BUILD.bazel`
63+
file, then you will have to restart `ghcid` itself.
64+
65+
[bazel-watcher]: https://github.com/bazelbuild/bazel-watcher#readme
66+
[ghcid]: https://github.com/ndmitchell/ghcid#readme

0 commit comments

Comments
 (0)