@@ -10,8 +10,8 @@ free to contribute.
10This document assumes that you are already familiar with Idris. It is
10This document assumes that you are already familiar with Idris. It is
11intended for those who want to work on the internals.
11intended for those who want to work on the internals.
13−People looking to develop new back ends may want to look at [[Idris back
13+People looking to develop new back ends may want to look at
14−end IRs\|Idris-back-end-IRs]]
14+:ref:`code-generation-targets`
@@ -53,7 +53,7 @@ with ``SC`` and ``CaseAlt`` to get GHC to generate a function for
53mapping over contained terms.
53mapping over contained terms.
55Constructor cases (``ConCase`` in ``CaseAlt``) refer to numbered
55Constructor cases (``ConCase`` in ``CaseAlt``) refer to numbered
56−constructors. Every constructor is numbered 0,1,2,…. At this stage in
56+constructors. Every constructor is numbered *0,1,2,…*. At this stage in
57the compiler, the tags are datatype-local. After defunctionalization,
57the compiler, the tags are datatype-local. After defunctionalization,
58however, they are made globally unique.
58however, they are made globally unique.
@@ -91,12 +91,12 @@ dictionary which makes totality checking easier.
91The ``normalise*`` functions give different behaviors - but
91The ``normalise*`` functions give different behaviors - but
92``normalise`` is the most common.
92``normalise`` is the most common.
94−``normaliseC`` - "resolved" means with names converted to de Bruijn
94+- ``normaliseC`` - "resolved" means with names converted to de Bruijn
95−indices as appropriate.
95+ indices as appropriate;
97−``normaliseAll`` - reduce everything, even if it's non-total
97+- ``normaliseAll`` - reduce everything, even if it's non-total;
99−``normaliseTrace`` - special-purpose for debugging
99+- ``normaliseTrace`` - special-purpose for debugging.
101``simplify`` - reduce the things that are small - the list argument is
101``simplify`` - reduce the things that are small - the list argument is
102the things to not reduce.
102the things to not reduce.
@@ -110,8 +110,8 @@ Core/Elaborate.hs
110=================
110=================
112Idris definitions are elaborated one by one and turned into the
112Idris definitions are elaborated one by one and turned into the
113−corresponding TT. This is done with a tactic language as an EDSL in the
113+corresponding ``TT``. This is done with a tactic language as an EDSL in the
114−Elab monad (or Elab' when there's a custom state).
114+``Elab`` monad (or ``Elab'`` when there's a custom state).
116Lots of plumbing for errors.
116Lots of plumbing for errors.
@@ -122,17 +122,17 @@ The string in the pair returned by elaborate is log information.
122See JFP paper, but the names don't necessarily map to each other. The
122See JFP paper, but the names don't necessarily map to each other. The
123paper is the "idealized version" without logging, additional state, etc.
123paper is the "idealized version" without logging, additional state, etc.
125−All the tactics take Raws, typechecking happens there.
125+All the tactics take ``Raw`` s, typechecking happens there.
127−claim (x : t) assumes a new x : t.
127+``claim (x : t)`` assumes a new ``x : t``.
129PLEASE TIDY THINGS UP!
129PLEASE TIDY THINGS UP!
131−proofSearch flag to try' is whether the failure came from a human (so
131+``proofSearch`` flag is to try whether the failure came from a human (so
132fail) or from a machine (so continue)
132fail) or from a machine (so continue)
134−Idris-level syntax for providing alternatives explicitly: (\| x, y, z
134+Idris-level syntax for providing alternatives explicitly: ``(| x, y, z
135−\|) try x, y, z in order, and take the first that succeeds.
135+|)`` try ``x``, ``y``, ``z`` in order, and take the first that succeeds.
137Core/ProofState.hs
137Core/ProofState.hs
138==================
138==================
@@ -140,37 +140,40 @@ Core/ProofState.hs
140Core/Unify.hs
140Core/Unify.hs
141=============
141=============
143−Deals with unification. Unification can reply with: - this works - this
143+Deals with unification. Unification can reply with:
144−can never work - this will work if these other unification problems work
145−out (eg unifying f x with 1)
146+- this can never work
147+- this will work if these other unification problems work out (e.g.
148+ unifying ``f x`` with ``1``)
147−match\_unify: same thing as unification except it's just matching name
150+``match_unify``: same thing as unification except it's just matching name
148−against name, term against term. x + y matches to 0 + y with x = 0. Used
151+against name, term against term. ``x + y`` matches to ``0 + y`` with
149−for <== syntax as well as type class resolution.
152+``x = 0``. Used for ``<==`` syntax as well as type class resolution.
151Idris/AbsSyntaxTree.hs
154Idris/AbsSyntaxTree.hs
152======================
155======================
154−PTerm is the datatype of Idris syntax. P is for Program. Each PTerm
157+``PTerm`` is the datatype of Idris syntax. ``P`` is for *Program*.
155−turns into a TT term by applying a series of tactics.
158+Each ``PTerm`` turns into a TT term by applying a series of tactics.
157−IState is the major interpreter state. The global context is the
160+``IState`` is the major interpreter state. The global context is the
158−tt\_ctxt field.
161+``tt_ctxt`` field.
160−Ctxt maps possibly ambiguous names to their referents.
163+``Ctxt`` maps possibly ambiguous names to their referents.
162Idris/ElabDecls.hs
165Idris/ElabDecls.hs
163==================
166==================
165−This is where the actual elaboration from PTerm to TT happens.
168+This is where the actual elaboration from ``PTerm`` to ``TT`` happens.
167Idris/ElabTerm.hs
170Idris/ElabTerm.hs
168=================
171=================
170−build is the function that creates a Raw. All the "junk" is to deal with
173+``build`` is the function that creates a ``Raw``. All the "junk" is to deal with
171things like metavars and so forth. It has to remember what names are
174things like metavars and so forth. It has to remember what names are
172still to be defined, and it doesn't yet know the type (filled in by
175still to be defined, and it doesn't yet know the type (filled in by
173unificaiton later). Also case expressions have to turn into top-level
176unificaiton later). Also case expressions have to turn into top-level
174functions.
177functions.
176−resolveTC is type class resolution.
179+``resolveTC`` is type class resolution.