<commit_before>School of Haskell
=================

The School of Haskell is a service providing interactive Haskell
tutorials and documentation.

How to use SoH on your site
---------------------------

Add the following script tags:

    <script src="//fb.me/react-0.12.0.min.js"></script>
    <script src="//cdn.rawgit.com/ajaxorg/ace-builds/v1.1.9/src-noconflict/ace.js"></script>
    <script src="//cdn.rawgit.com/chjj/term.js/v0.0.4/src/term.js"></script>
    <script src="http://soh-scheduler-1627848338.us-east-1.elb.amazonaws.com/static/soh.js"></script>

FIXME: it isn't so ideal to use git cdn.  These should be served by
our server.

FIXME: more description here.

How to build
------------

Installation requires the latest version of
[stack](https://github.com/commercialhaskell/stack).  The first time
you install SoH, you'll need to pull the docker image with:

```
stack docker pull
```

After this, run `./dev-scripts/build-all.sh` to build everything.
Often, you can avoid doing a full rebuild, and only invoke the
commands you need:

* If you change any of the GHCJS dependencies (everything in the
  `deps/` folder except `deps/ide-backend/`), then you need to run
  `./dev-scripts/install-ghcjs-deps.sh`.

* If you change `soh-client/`, then you need to run
  `dev-scripts/build-client.sh`.

* If you change `soh-runner/`, `deps/ide-backend-client/`, or
  `deps/ide-backend`, then next, you need to run
  `./dev-scripts/make-container-image.sh`.  This creates the docker
  image used for the runner.

This can be a bit tricky to remember, so maybe it's best to just stick
with `./dev-scripts/build-all.sh`!

How to run locally
------------------

FIXME: this section is out of date because now soh-scheduler serves
the client.

Assuming it's built with `--flag soh-server:dev`, run the
following scripts in separate terminals:

```
./dev-scripts/soh-server.sh
```

```
./dev-scripts/soh-runner.sh
```

Then, point your browser at `localhost:5000`.<commit_msg>Add description of a workaround for build issues<commit_after>School of Haskell
=================

The School of Haskell is a service providing interactive Haskell
tutorials and documentation.

How to use SoH on your site
---------------------------

Add the following script tags:

    <script src="//fb.me/react-0.12.0.min.js"></script>
    <script src="//cdn.rawgit.com/ajaxorg/ace-builds/v1.1.9/src-noconflict/ace.js"></script>
    <script src="//cdn.rawgit.com/chjj/term.js/v0.0.4/src/term.js"></script>
    <script src="http://soh-scheduler-1627848338.us-east-1.elb.amazonaws.com/static/soh.js"></script>

FIXME: it isn't so ideal to use git cdn.  These should be served by
our server.

FIXME: more description here.

How to build
------------

Installation requires the latest version of
[stack](https://github.com/commercialhaskell/stack).  The first time
you install SoH, you'll need to pull the docker image with:

```
stack docker pull
```

After this, run `./dev-scripts/build-all.sh` to build everything.
Often, you can avoid doing a full rebuild, and only invoke the
commands you need:

* If you change any of the GHCJS dependencies (everything in the
  `deps/` folder except `deps/ide-backend/`), then you need to run
  `./dev-scripts/install-ghcjs-deps.sh`.

* If you change `soh-client/`, then you need to run
  `dev-scripts/build-client.sh`.

* If you change `soh-runner/`, `deps/ide-backend-client/`, or
  `deps/ide-backend`, then next, you need to run
  `./dev-scripts/make-container-image.sh`.  This creates the docker
  image used for the runner.

This can be a bit tricky to remember, so maybe it's best to just stick
with `./dev-scripts/build-all.sh`!

How to run locally
------------------

FIXME: this section is out of date because now soh-scheduler serves
the client.

Assuming it's built with `--flag soh-server:dev`, run the
following scripts in separate terminals:

```
./dev-scripts/soh-server.sh
```

```
./dev-scripts/soh-runner.sh
```

Then, point your browser at `localhost:5000`.

Resolving build issues
----------------------

I've run into an issue where an error like this occurs while
installing ghcjs deps:

```
IdeSession/RPC/Server.hs:94:22:
    Exception when trying to run compile-time code:
      exported function not found: Fun {funPackage = Package {unPackage = "ide-backend-common-0.9.1.2"}, funModule = "IdeSession.RPC.Stream", funSymbol = "h$idezmbackendzmcommonzm0zi9zi1zi2ZCIdeSessionziRPCziStreamzinextInStream2"}
    Code: waitAny
    In the splice: $waitAny
```

It seems probable that it's
[this ghcjs bug](https://github.com/ghcjs/ghcjs/issues/349) which has
to do with using an older `.js_a` with a newer `.js_o`.  That bug has
been fixed, but the fix is not in our version of ghcjs.  I've found
that a good way to resolve this is to do a `stack docker reset`.
{'fraction_non_alphanumeric': 0.15139525197834236, 'fraction_numerical': 0.013744273219491879, 'mean_word_length': 3.327027027027027, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2905406', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1537, 'n_words': 531}