https://github.com/aherrmann/example_servant_elm_bazel
https://github.com/aherrmann/example_servant_elm_bazel
bazel elm-lang haskell servant
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aherrmann/example_servant_elm_bazel
- Owner: aherrmann
- License: mit
- Created: 2020-04-28T20:26:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T03:47:54.000Z (about 3 years ago)
- Last Synced: 2025-06-19T08:07:08.375Z (8 months ago)
- Topics: bazel, elm-lang, haskell, servant
- Language: Elm
- Homepage:
- Size: 104 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# todo app

A minimal todo app implemented in [Haskell][haskell] using [Servant][servant]
on the backend, and in [Elm][elm] on the frontend, built with [Bazel][bazel]
using [`rules_haskell`][rules_haskell] and [`rules_elm`][rules_elm].
[haskell]: https://www.haskell.org/
[servant]: https://hackage.haskell.org/package/servant
[elm]: https://elm-lang.org/
[bazel]: https://bazel.build/
[rules_haskell]: https://haskell.build/
[rules_elm]: https://github.com/EdSchouten/rules_elm
## Requirements
You will need the [dependencies of `rules_haskell`][dependencies]
installed on your system to build.
On MacOS you also need to set the following environment variable:
```
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
```
[dependencies]: https://rules-haskell.readthedocs.io/en/latest/haskell.html#before-you-begin
## Instructions
Execute the following command to build and start the app:
```
$ bazel run //backend
```
Then browse to `http://localhost:8080` to use the app.
## Interactive Development
You can use [`bazel-watcher`][bazel-watcher] to continuously rebuild the
frontend whenever any of its sources change, like so.
```
$ ibazel build //frontend
```
You can use [`ghcid`][ghcid] to continuously reload the backend whenever
any of its sources change, like so.
```
$ ghcid --command="bazel run //backend:backend@ghci" \
--test=Main.main \
--setup=":set args --assets bazel-bin/frontend/frontend.tar" \
--reload=bazel-bin/frontend/frontend.tar
```
This will load the Haskell code into a GHCi session and run the server in
the interpreter. It will reload the session and restart the server
whenever any of the Haskell source files or the frontend bundle changes.
Note, if the dependency graph changes, e.g. when you edit a `BUILD.bazel`
file, then you will have to restart `ghcid` itself.
[bazel-watcher]: https://github.com/bazelbuild/bazel-watcher#readme
[ghcid]: https://github.com/ndmitchell/ghcid#readme