Skip to content

Commit

Permalink
Update links in documentation (#184)
Browse files Browse the repository at this point in the history
* Fix formatting / links in tutorial notebooks

* Fix ordering and numbering of tutorial links

* Add symlink to ensure Contents links in haddocks work

* Update template commit

* Remove redundant example stack.yaml
  • Loading branch information
dorranh authored Jul 23, 2021
1 parent 3253698 commit 411a151
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 139 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ While funflow hasn't been plublished on Hackage yet, you can install it as a git
dependency using the standard Haskell tooling (e.g.
[Stack](https://docs.haskellstack.org/en/stable/yaml_configuration/#packages)).
Note that you will also need to add a couple of extra dependencies to your
`stack.yaml`. See the [example stack.yaml](./docs/example-user-stack.yaml) for a
`stack.yaml`. See the [example stack.yaml](./cookiecutter-funflow/{{cookiecutter.project_name}}/stack.yaml) for a
minimal example.

### Tutorials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extra-deps:
- caching
# Funflow libraries
- git: https://github.com/tweag/funflow.git
commit: 32e3f4b873ad0be010964561c10e6df4917280e6
commit: 32536980ce1ede26642cb34f2ea6a9175ad50001
subdirs:
- funflow
- docker-client
Expand Down
36 changes: 0 additions & 36 deletions docs/example-user-stack.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions funflow-pages/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ cp -r "$srcPagesIndex"/* "$out"/
mkdir -p "$out"/api
cp -r "$(nix-build -A api-docs)"/share/doc/* "$out"/api/
chmod -R +rwx "$out"/api/
# Add extra symlink for header "Contents" links
mkdir -p "$out"/api/share/doc/
ln -s "$out"/api/index.html "$out"/api/share/doc/doc-index.html

# Make tutorials
mkdir -p /tmp/funflow/store
Expand Down
14 changes: 12 additions & 2 deletions funflow-pages/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,17 @@ <h4>Tutorials</h4>
</div>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/Tutorial2.html">5. Advanced Tutorial</a>
<a href="/funflow/tutorials/CCompilation.html">5. Compiling C programs</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Compile and execute a simple C program using funflow.
</p>
</div>
</div>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/Tutorial2.html">6. Advanced Tutorial</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Expand All @@ -171,7 +181,7 @@ <h4>Tutorials</h4>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/TensorflowDocker.html">
6. Hands-on: ML Pipeline with Docker and TensorFlow
7. Hands-on: ML Pipeline with Docker and TensorFlow
</a>
</div>
<div class="toc-tutorial-item-description">
Expand Down
17 changes: 9 additions & 8 deletions funflow-pages/src/tutorials/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,38 @@ <h3>Tutorials</h3>
</div>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/CCompilation.html">4. Compiling C programs</a>
<a href="/funflow/tutorials/ErrorHandling.html">3. Error handling</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Compile and execute a simple C program using funflow.
Handle and throw errors in your pipelines.
</p>
</div>
</div>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/ErrorHandling.html">5. Error handling</a>
<a href="/funflow/tutorials/ExternalConfig.html">4. Configuration</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Handle and throw errors in your pipelines.
Learn how to configure tasks at load time.
</p>
</div>
</div>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/ExternalConfig.html">6. Configuration</a>
<a href="/funflow/tutorials/CCompilation.html">5. Compiling C programs</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Learn how to configure tasks at load time.
Compile and execute a simple C program using funflow.
</p>
</div>
</div>

<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/Tutorial2.html">7. Advanced Tutorial</a>
<a href="/funflow/tutorials/Tutorial2.html">6. Advanced Tutorial</a>
</div>
<div class="toc-tutorial-item-description">
<p>
Expand All @@ -89,7 +90,7 @@ <h3>Tutorials</h3>
<div class="toc-tutorial-item">
<div class="toc-tutorial-item-title">
<a href="/funflow/tutorials/TensorflowDocker.html">
8. Hands-on: ML Pipeline with Docker and TensorFlow
7. Hands-on: ML Pipeline with Docker and TensorFlow
</a>
</div>
<div class="toc-tutorial-item-description">
Expand Down
42 changes: 21 additions & 21 deletions funflow-tutorial/notebooks/Tutorial1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# First steps with `funflow`\n",
"\n",
Expand Down Expand Up @@ -71,24 +70,24 @@
"Often a `Task` value will be the argument to `toFlow`, but really it could be anything of a type for which an `IsFlow` instance is available, as that's the class that declares `toFlow`. The resulting `Flow` value can then be composed with other flows into a larger, final `Flow` DAG.\n",
"\n",
"Here is a `Flow` that runs a `PureTask`, incrementing its input by 1."
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import Funflow (Flow, toFlow)\n",
"import Funflow.Tasks.Simple (SimpleTask (PureTask))\n",
"\n",
"flow :: Flow Int Int\n",
"flow = toFlow $ PureTask (+1)"
]
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this example, `flow` is essentially a DAG with one node, `PureTask (+1)`. \n",
"Here is a flow that runs a simple IO task which prints its input.\n",
Expand Down Expand Up @@ -135,50 +134,51 @@
"\n",
"It will return a result of type `IO output` where `output` is the output type of `flow`.\n",
"Let's run our flow from earlier:"
]
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"source": [
"import Funflow (runFlow)\n",
"\n",
"runFlow flow (1 :: Int) :: IO Int"
],
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": [
"2"
]
},
"metadata": {},
"output_type": "display_data"
"metadata": {}
}
],
"source": [
"import Funflow (runFlow)\n",
"\n",
"runFlow flow (1 :: Int) :: IO Int"
]
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As expected, it returned 2.\n",
"\n",
"Astute readers may have noticed that the output of `runFlow` is of type `IO output` and not simply `output`.\n",
"This wrapping of `output` in `IO` happens because `runFlow` uses a context to accommodate execution of any task type.\n",
"Since `runFlow` supports IO and Docker tasks, ecah of which utilizes IO, the output of `runFlow` must also be wrapped by `IO`."
]
],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Next Steps\n",
"\n",
"With the basics out of the way, you should be ready to write and run your first `Flow`!\n",
"\n",
"Check out the [wordcount flow tutorial](./wordcount.html) for a guided example."
]
"Check out the [wordcount flow tutorial](./WordCount.html) for a guided example."
],
"metadata": {}
}
],
"metadata": {
Expand All @@ -198,4 +198,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Loading

0 comments on commit 411a151

Please sign in to comment.