<commit_before>!(spider offering hot choclety hask)[choclety_hask.png]

# choclety-hask

Generate graphs from [Servant](http://haskell-servant.readthedocs.io) API types.
Inspired by [choclety](https://github.com/mooreniemi/choclety).

## Use

This library helps you render
your [Servant](http://haskell-servant.readthedocs.io) API as a state machine,
with representations as states and requests as state transitions. This could be
useful, for example, when looking for the shortest path(s) to reach a desired
state (such as a revenue-generating action).

## Prerequisites
- [haskell-stack](https://www.haskellstack.org/): `curl -sSL https://get.haskellstack.org/ | sh`
    - run `stack setup` to obtain the Haskell compiler

## Usage

The library exposes a function, `choclety`, that generates graph JSON suitable
for use with the included viewer (`index.html`).

To generate a graph for use with Cytoscape.js:

`stack build && stack exec choclety`

To view the graph, serve up the local directory, e.g. by `python -m SimpleHTTPServer 8090`, and view [127.0.0.1:8090](http://127.0.0.1:8090).

To serve up the example API on port 8080:

`stack exec choclety-server`

To run the test suite:

`stack test`<commit_msg>add link in readme<commit_after>![spider offering hot choclety hask](choclety_hask.png)

# choclety-hask

Generate graphs from [Servant](http://haskell-servant.readthedocs.io) API types.
Inspired by [choclety](https://github.com/mooreniemi/choclety).

## Use

This library helps you render
your [Servant](http://haskell-servant.readthedocs.io) API as a state machine,
with representations as states and requests as state transitions. This could be
useful, for example, when looking for the shortest path(s) to reach a desired
state (such as a revenue-generating action).

## Prerequisites
- [haskell-stack](https://www.haskellstack.org/): `curl -sSL https://get.haskellstack.org/ | sh`
    - run `stack setup` to obtain the Haskell compiler

## Usage

The library exposes a function, `choclety`, that generates graph JSON suitable
for use with the included [viewer](https://corajr.github.io/choclety-hask/index.html).

To generate a graph for use with Cytoscape.js:

`stack build && stack exec choclety`

To view the graph, serve up the local directory, e.g. by `python -m SimpleHTTPServer 8090`, and view [127.0.0.1:8090](http://127.0.0.1:8090).

To serve up the example API on port 8080:

`stack exec choclety-server`

To run the test suite:

`stack test`
{'fraction_non_alphanumeric': 0.11007689194658034, 'fraction_numerical': 0.0226628895184136, 'mean_word_length': 4.517857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 7, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, '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': '1104899', 'n_tokens_mistral': 868, 'n_tokens_neox': 809, 'n_words': 285}