on master help sign in
Fixed the last set (hopefull) of errors from the pandoc conversion.
673bb99Jan de Muijnck-Hughes
docs/effects/impleff.rst+7−6
@@ -5,12 +5,13 @@ Creating New Effects
5====================
5====================
6
6
7We have now seen several side-effecting operations provided by the
7We have now seen several side-effecting operations provided by the
8−library, and examples of their use in Section :ref:`sect-simpleff`. We have
8+``Effects`` library, and examples of their use in Section
9+:ref:`sect-simpleff`. We have also seen how operations may *modify*
9−also seen how operations may *modify* the available effects by changing
10+the available effects by changing state in Section
10−state in Section :ref:`sect-depeff`. We have not, however, yet seen how these
11+:ref:`sect-depeff`. We have not, however, yet seen how these
11−operations are implemented. In this section, we describe how a selection
12+operations are implemented. In this section, we describe how a
12−of the available effects are implemented, and show how new effectful
13+selection of the available effects are implemented, and show how new
13−operations may be provided.
14+effectful operations may be provided.
14
15
15State
16State
16-----
17-----
docs/effects/introduction.rst+26−24
@@ -14,9 +14,10 @@ supports programming and reasoning with side-effecting programs,
14supporting mutable state, interaction with the outside world,
14supporting mutable state, interaction with the outside world,
15exceptions, and verified resource management.
15exceptions, and verified resource management.
16
16
17−This tutorial assumes familiarity with pure programming in , as
17+This tutorial assumes familiarity with pure programming in ``Idris``,
18−described in Sections 1–6 of the main tutorial [1]_. The examples are
18+as described in Sections 1–6 of the main tutorial [1]_. The examples
19−tested with version .
19+are presented are tested with ``Idris`` and can be found in the
20+examples directory of the ``Idris`` repository.
20
21
21Consider, for example, the following introductory function which
22Consider, for example, the following introductory function which
22illustrates the kind of properties which can be expressed in the type
23illustrates the kind of properties which can be expressed in the type
@@ -46,16 +47,16 @@ able to apply the ``vadd`` function? Before doing so, we will have to:
46
47
47The complete program will include side-effects for I/O and error
48The complete program will include side-effects for I/O and error
48handling, before we can get to the pure core functionality. In this
49handling, before we can get to the pure core functionality. In this
49−tutorial, we will see how supports side-effects. Furthermore, we will
50+tutorial, we will see how ``Idris`` supports side-effects.
50−see how we can use the dependent type system to *reason* about stateful
51+Furthermore, we will see how we can use the dependent type system to
51−and side-effecting programs. We will return to this specific example
52+*reason* about stateful and side-effecting programs. We will return to
52−later.
53+this specific example later.
53
54
54Hello world
55Hello world
55===========
56===========
56
57
57To give an idea of how programs with effects look in , here is the
58To give an idea of how programs with effects look in , here is the
58−ubiquitous “Hello world” program, written using the library:
59+ubiquitous “Hello world” program, written using the ``Effects`` library:
59
60
60.. code-block:: idris
61.. code-block:: idris
61
62
@@ -74,8 +75,8 @@ the ``hello`` function which supports the ``STDIO`` effect for console
74I/O, and returns the unit value. The details of the ``Eff`` type will be
75I/O, and returns the unit value. The details of the ``Eff`` type will be
75presented in the remainder of this tutorial.
76presented in the remainder of this tutorial.
76
77
77−To compile and run this program, needs to be told to include the
78+To compile and run this program, ``Idris`` needs to be told to include the
78−package, using the ``-p`` flag (this flag is required for all examples
79+``Effects`` package, using the ``-p effects`` flag (this flag is required for all examples
79in this tutorial):
80in this tutorial):
80
81
81.. code-block:: sh
82.. code-block:: sh
@@ -86,20 +87,21 @@ in this tutorial):
86Outline
87Outline
87=======
88=======
88
89
89−The tutorial is structured as follows: first, in :ref:`sect-state`,
90+The tutorial is structured as follows: first, in :ref:`sect-state`, we
90−we will discuss state management, describing why it is important and
91+will discuss state management, describing why it is important and
91−introducing the library to show how it can be used to manage state. This
92+introducing the ``effects`` library to show how it can be used to
92−section also gives an overview of the syntax of effectful programs.
93+manage state. This section also gives an overview of the syntax of
93−:ref:`sect-simpleff` then introduces a number of other effects a
94+effectful programs. :ref:`sect-simpleff` then introduces a number of
94−program may have: I/O; Exceptions; Random Numbers; and Non-determinism,
95+other effects a program may have: I/O; Exceptions; Random Numbers; and
95−giving examples for each, and an extended example combining several
96+Non-determinism, giving examples for each, and an extended example
96−effects in one complete program. :ref:`sect-depeff` introduces
97+combining several effects in one complete program. :ref:`sect-depeff`
97−*dependent* effects, showing how states and resources can be managed in
98+introduces *dependent* effects, showing how states and resources can
98−types. :ref:`sect-impleff` shows how new effects can be implemented.
99+be managed in types. :ref:`sect-impleff` shows how new effects can be
99−:ref:`sect-hangman` gives an extended example showing how to
100+implemented. :ref:`sect-hangman` gives an extended example showing
100−implement a “mystery word” guessing game, using effects to describe the
101+how to implement a “mystery word” guessing game, using effects to
101−rules of the game and ensure they are implemented accurately. References
102+describe the rules of the game and ensure they are implemented
102−to further reading are given in :ref:`sect-further`.
103+accurately. References to further reading are given in
104+:ref:`sect-further`.
103
105
104.. [1]
106.. [1]
105 You do not, however, need to know what a monad is. A correctness
107 You do not, however, need to know what a monad is. A correctness
docs/tutorial/classes.rst+4−3
@@ -195,8 +195,9 @@ Monads and ``do``-notation
195--------------------------
195--------------------------
196
196
197The ``Monad`` class allows us to encapsulate binding and computation,
197The ``Monad`` class allows us to encapsulate binding and computation,
198−and is the basis of ``do``-notation introduced in Section [sect:do]. It
198+and is the basis of ``do``-notation introduced in Section 
199−extends ``Applicative`` as defined above, and is defined as follows:
199+:ref:`sect-do`. It extends ``Applicative`` as defined above, and is
200+defined as follows:
200
201
201.. code-block:: idris
202.. code-block:: idris
202
203
@@ -384,7 +385,7 @@ An error-handling interpreter
384~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
385
386
386Idiom notation is commonly useful when defining evaluators. McBride and
387Idiom notation is commonly useful when defining evaluators. McBride and
387−Paterson describe such an evaluator [1], for a language similar to the
388+Paterson describe such an evaluator [1]_, for a language similar to the
388following:
389following:
389
390
390.. code-block:: idris
391.. code-block:: idris
docs/tutorial/typesfuns.rst+4
@@ -518,6 +518,8 @@ for reading and writing files, including:
518
518
519 readFile : String -> IO String
519 readFile : String -> IO String
520
520
521+.. _sect-do:
522+
521“``do``” notation
523“``do``” notation
522-----------------
524-----------------
523
525
@@ -825,6 +827,8 @@ intermediate values:
825
827
826We will see more on ``with`` notation later.
828We will see more on ``with`` notation later.
827
829
830+.. _sect-more-expr:
831+
828More Expressions
832More Expressions
829----------------
833----------------
830
834