Skip to content

Commit 831e5d4

Browse files
smelcmergify-bot
authored andcommitted
tutorial: mention the WORKSPACE file
highlight that the way to obtain rules_haskell in tutorial/WORKSPACE is limited to the tutorial's case, otherwise better refer to the template created by start also link to Common Haskell Build Use Cases to highlight the other mandatory thing in WORKSPACE file: obtaining GHC I tried to make a minimal addition, so as to avoid polluting the tutorial; yet giving the sufficient pointers to make users able to set up a toolchain
1 parent 9a52a45 commit 831e5d4

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

docs/haskell.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ On a Unix system you will need the following tools installed.
3232
* ``libgmp``
3333
* ``libtinfo5``
3434
* ``make``
35-
* ``python3`` (``python`` also needs to be available in ``$PATH``. Depending on your distro, this might require installing the ``python`` meta-package, which might use Python 2 or 3, ``rules_haskell`` works with both.)
35+
* ``python3`` (``python`` also needs to be available in ``$PATH``. Depending on your distribution, this might require installing the ``python`` meta-package, which might use Python 2 or 3, ``rules_haskell`` works with both.)
3636

3737
On Ubuntu you can obtain them by installing the following packages. ::
3838

@@ -89,14 +89,32 @@ special:
8989
contains a ``BUILD.bazel`` file is a *package*. You will learn about
9090
packages later in this tutorial.)
9191

92-
To designate a directory as a Bazel workspace, create an empty file
92+
To designate a directory as a Bazel workspace, create a file
9393
named ``WORKSPACE`` in that directory.
94+
This file defines `external dependencies`_.
9495

9596
When Bazel builds the project, all inputs and dependencies must be in
9697
the same workspace. Files residing in different workspaces are
9798
independent of one another unless linked, which is beyond the scope of
9899
this tutorial.
99100

101+
Understand the WORKSPACE file
102+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103+
104+
File ``tutorial/WORKSPACE`` defines how to obtain ``rules_haskell``
105+
and a compiler toolchain. Because this tutorial lives in ``rules_haskell``'s
106+
repository, ``rules_haskell`` is made available as follows::
107+
108+
local_repository(
109+
name = "rules_haskell",
110+
path = "..",
111+
)
112+
113+
We refer to the template created by the start_ script
114+
to make ``rules_haskell`` available outside a local clone.
115+
The ``WORKSPACE`` file also defines how to obtain the compiler toolchain,
116+
as detailed in section `picking a compiler`_.
117+
100118
Understand the BUILD file
101119
^^^^^^^^^^^^^^^^^^^^^^^^^
102120

@@ -379,6 +397,8 @@ Happy building!
379397
.. _haskell_toolchain_library: http://api.haskell.build/haskell/haskell.html#haskell_toolchain_library
380398
.. _haskell_library: http://api.haskell.build/haskell/haskell.html#haskell_library
381399
.. _graphviz: https://www.graphviz.org/
400+
.. _start: https://rules-haskell.readthedocs.io/en/latest/haskell-use-cases.html#starting-a-new-project
401+
.. _picking a compiler: https://rules-haskell.readthedocs.io/en/latest/haskell-use-cases.html#picking-a-compiler
382402
.. _external dependencies: https://docs.bazel.build/versions/master/external.html
383403
.. _build encyclopedia: https://docs.bazel.build/versions/master/be/overview.html
384404
.. _C++ build tutorial: https://docs.bazel.build/versions/master/tutorial/cpp.html

0 commit comments

Comments
 (0)