@@ -7,13 +7,13 @@ Types and Functions
77Primitive Types
88---------------
99
10−``Idris`` defines several primitive types: ``Int``, ``Integer`` and
10+Idris defines several primitive types: ``Int``, ``Integer`` and
1111``Float`` for numeric operations, ``Char`` and ``String`` for text
1212manipulation, and ``Ptr`` which represents foreign pointers. There are
1313also several data types declared in the library, including ``Bool``,
1414with values ``True`` and ``False``. We can declare some constants with
1515these types. Enter the following into a file ``prims.idr`` and load it
16−into the ``Idris`` interactive environment by typing ``idris
16+into the Idris interactive environment by typing ``idris
1717prims.idr``:
1818
1919.. code-block:: idris
@@ -32,9 +32,9 @@ prims.idr``:
3232 quux : Bool
3333 quux = False
3434
35−An ``Idris`` file consists of an optional module declaration (here
35+An Idris file consists of an optional module declaration (here
3636``module prims``) followed by an optional list of imports (none here,
37−however ``Idris`` programs can consist of several modules, and the
37+however Idris programs can consist of several modules, and the
3838definitions in each module each have their own namespace, as we will
3939discuss in Section :ref:`sect-namespaces`) and a collection of
4040declarations and definitions. The order of definitions is significant
@@ -46,7 +46,7 @@ declaration. Alternatively, declarations may be terminated with a
4646semicolon.
4747
4848A library module ``prelude`` is automatically imported by every
49−``Idris`` program, including facilities for IO, arithmetic, data
49+Idris program, including facilities for IO, arithmetic, data
5050structures and various common functions. The prelude defines several
5151arithmetic and comparison operators, which we can use at the prompt.
5252Evaluating things at the prompt gives an answer, and the type of the
@@ -108,7 +108,7 @@ Functions
108108---------
109109
110110Functions are implemented by pattern matching, again using a similar
111−syntax to Haskell. The main difference is that ``Idris`` requires type
111+syntax to Haskell. The main difference is that Idris requires type
112112declarations for all functions, using a single colon ``:`` (rather
113113than Haskell’s double colon ``::``). Some natural number arithmetic
114114functions can be defined as follows, again taken from the standard
@@ -133,7 +133,7 @@ names must begin with a capital letter or not. Function names
133133(``plus`` and ``mult`` above), data constructors (``Z``, ``S``,
134134``Nil`` and ``::``) and type constructors (``Nat`` and ``List``) are
135135all part of the same namespace. We can test these functions at the
136−``Idris`` prompt:
136+Idris prompt:
137137
138138::
139139
@@ -144,10 +144,10 @@ all part of the same namespace. We can test these functions at the
144144
145145.. note::
146146
147− ``Idris`` automatically desugars the ``Nat`` representation into a
147+ Idris automatically desugars the ``Nat`` representation into a
148148 more human readable format. The result of ``plus (S (S Z)) (S (S Z))``
149149 is actually ``(S (S (S (S Z))))`` which is the Integer 4. This can be
150− checked at the ``Idris`` prompt:
150+ checked at the Idris prompt:
151151
152152::
153153
@@ -169,7 +169,7 @@ computers have perfectly good integer arithmetic built in. The reason
169169is primarily that unary numbers have a very convenient structure which
170170is easy to reason about, and easy to relate to other data structures
171171as we will see later. Nevertheless, we do not want this convenience to
172−be at the expense of efficiency. Fortunately, ``Idris`` knows about
172+be at the expense of efficiency. Fortunately, Idris knows about
173173the relationship between ``Nat`` (and similarly structured types) and
174174numbers. This means it can optimise the representation, and functions
175175such as ``plus`` and ``mult``.
@@ -248,7 +248,7 @@ Vectors
248248
249249A standard example of a dependent type is the type of “lists with
250250length”, conventionally called vectors in the dependent type
251−literature. They are available as part of the ``Idris`` library, by
251+literature. They are available as part of the Idris library, by
252252importing ``Data.Vect``, or we can declare them as follows:
253253
254254.. code-block:: idris
@@ -258,7 +258,7 @@ importing ``Data.Vect``, or we can declare them as follows:
258258 (::) : a -> Vect k a -> Vect (S k) a
259259
260260Note that we have used the same constructor names as for ``List``.
261−Ad-hoc name overloading such as this is accepted by ``Idris``,
261+Ad-hoc name overloading such as this is accepted by Idris,
262262provided that the names are declared in different namespaces (in
263263practice, normally in different modules). Ambiguous constructor names
264264can normally be resolved from context.
@@ -289,7 +289,7 @@ defined as follows, appends two ``Vect``:
289289
290290The type of ``(++)`` states that the resulting vector’s length will be
291291the sum of the input lengths. If we get the definition wrong in such a
292−way that this does not hold, ``Idris`` will not accept the definition.
292+way that this does not hold, Idris will not accept the definition.
293293For example:
294294
295295.. code-block:: idris
@@ -298,7 +298,7 @@ For example:
298298 (++) Nil ys = ys
299299 (++) (x :: xs) ys = x :: xs ++ xs -- BROKEN
300300
301−When run through the ``Idris`` type checker, this results in the
301+When run through the Idris type checker, this results in the
302302following:
303303
304304::
@@ -325,7 +325,7 @@ The Finite Sets
325325~~~~~~~~~~~~~~~
326326
327327Finite sets, as the name suggests, are sets with a finite number of
328−elements. They are available as part of the ``Idris`` library, by
328+elements. They are available as part of the Idris library, by
329329importing ``Data.Fin``, or can be declared as follows:
330330
331331.. code-block:: idris
@@ -480,9 +480,9 @@ I/O
480480
481481Computer programs are of little use if they do not interact with the
482482user or the system in some way. The difficulty in a pure language such
483−as ``Idris`` — that is, a language where expressions do not have
483+as Idris — that is, a language where expressions do not have
484484side-effects — is that I/O is inherently side-effecting. Therefore in
485−``Idris``, such interactions are encapsulated in the type ``IO``:
485+Idris, such interactions are encapsulated in the type ``IO``:
486486
487487.. code-block:: idris
488488
@@ -567,7 +567,7 @@ Laziness
567567--------
568568
569569Normally, arguments to functions are evaluated before the function
570−itself (that is, ``Idris`` uses *eager* evaluation). However, this is
570+itself (that is, Idris uses *eager* evaluation). However, this is
571571not always the best approach. Consider the following function:
572572
573573.. code-block:: idris
@@ -579,7 +579,7 @@ not always the best approach. Consider the following function:
579579This function uses one of the ``t`` or ``e`` arguments, but not both
580580(in fact, this is used to implement the ``if...then...else`` construct
581581as we will see later. We would prefer if *only* the argument which was
582−used was evaluated. To achieve this, ``Idris`` provides a ``Lazy``
582+used was evaluated. To achieve this, Idris provides a ``Lazy``
583583data type, which allows evaluation to be suspended:
584584
585585.. code-block:: idris
@@ -590,7 +590,7 @@ data type, which allows evaluation to be suspended:
590590 Force : Lazy a -> a
591591
592592A value of type ``Lazy a`` is unevaluated until it is forced by
593−``Force``. The ``Idris`` type checker knows about the ``Lazy`` type,
593+``Force``. The Idris type checker knows about the ``Lazy`` type,
594594and inserts conversions where necessary between ``Lazy a`` and ``a``,
595595and vice versa. We can therefore write ``boolCase`` as follows,
596596without any explicit use of ``Force`` or ``Delay``:
@@ -604,10 +604,10 @@ without any explicit use of ``Force`` or ``Delay``:
604604Useful Data Types
605605-----------------
606606
607−``Idris`` includes a number of useful data types and library functions
607+Idris includes a number of useful data types and library functions
608608(see the ``libs/`` directory in the distribution). This chapter
609609describes a few of these. The functions described here are imported
610−automatically by every ``Idris`` program, as part of ``Prelude.idr``.
610+automatically by every Idris program, as part of ``Prelude.idr``.
611611
612612``List`` and ``Vect``
613613~~~~~~~~~~~~~~~~~~~~~
@@ -679,7 +679,7 @@ directory. For more details of the functions available on ``List`` and
679679- ``libs/base/Data/VectType.idr``
680680
681681Functions include filtering, appending, reversing, and so on. Also
682−remember that ``Idris`` is still in development, so if you don’t see
682+remember that Idris is still in development, so if you don’t see
683683the function you need, please feel free to add it and submit a patch!
684684
685685Aside: Anonymous functions and operator sections
@@ -877,7 +877,7 @@ pattern matching at the top level:
877877List comprehensions
878878~~~~~~~~~~~~~~~~~~~
879879
880−``Idris`` provides *comprehension* notation as a convenient shorthand
880+Idris provides *comprehension* notation as a convenient shorthand
881881for building lists. The general form is:
882882
883883::
@@ -958,10 +958,10 @@ matching ``let`` and lambda bindings. It will *only* work if:
958958Dependent Records
959959-----------------
960960
961−*Records* are data types which collect several values (the record’s
962−*fields*) together. ``Idris`` provides syntax for defining records and
961+*Records* are data types which collect several values (the record's
962+*fields*) together. Idris provides syntax for defining records and
963963*automatically generating field access and update functions. For
964−*example, we can represent a person’s name and age in a record:
964+*example, we can represent a person's name and age in a record:
965965
966966.. code-block:: idris
967967
@@ -1029,7 +1029,7 @@ length because it will not affect the type of the record:
10291029Nested record update
10301030~~~~~~~~~~~~~~~~~~~~
10311031
1032−``Idris`` also provides a convenient syntax for accessing and updating
1032+Idris also provides a convenient syntax for accessing and updating
10331033nested records. For example, if a field is accessible with the
10341034expression ``c (b (a x))``, it can be updated using the following
10351035syntax: