Skip to content

Commit

Permalink
issue7020: add note about compilation of irrelevant fields (#7026)
Browse files Browse the repository at this point in the history
  • Loading branch information
UlfNorell committed Dec 11, 2023
1 parent 02eb3a9 commit 8cf0bae
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/user-manual/tools/compilers.lagda.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
..
::
{-# OPTIONS --erasure #-}
module tools.compilers where
open import Agda.Builtin.Nat

.. _compilers:

***********
Expand Down Expand Up @@ -193,6 +196,28 @@ it is recommended to use a different, but
isomorphic type to the builtin natural numbers.


Irrelevant fields and constructor arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Record fields and constructor arguments marked :ref:`irrelevant<irrelevance>`
or :ref:`runtime irrelevant<runtime-irrelevance>` are completely erased from
the compiled record or data type. For instance, ::

postulate Parity : Nat → Set

record PNat : Set where
field
n : Nat
.p : Parity n
@0 q : Parity (suc n)

gets compiled by the GHC backend to (up to naming)

.. code-block:: haskell
newtype PNat = PNat'constructor Integer
Erasable types
~~~~~~~~~~~~~~

Expand Down

0 comments on commit 8cf0bae

Please sign in to comment.