user6086: Aim: document a repo with plutus code using haddock.
Problem: Naively running cabal haddock has a problem that seems to be caused by plutus (on-chain) code.
For example, plutus-pioneer-program week03 runs in the repl with cabal repl, but cabal haddock errors as follows.
Haddock coverage:
GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable Ledger.Typed.Scripts.Validators.wrapValidator
            No unfolding
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum @ ()
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
                           @ ()
                           Week03.Homework1.$fUnsafeFromDataVestingDatum
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
                           @ ()
                           Week03.Homework1.$fUnsafeFromDataVestingDatum
                           PlutusTx.IsData.Instances.$fUnsafeFromData()
Context: Compiling expr at "plutus-pioneer-program-week03-0.1.0.0-inplace:Week03.Homework1:(60,8)-(60,37)"
cabal: Failed to build documentation for
plutus-pioneer-program-week03-0.1.0.0.

Is there a straightforward way to build haddock docs for repos with plutus code?

user6292: Yes! Try cabal haddock -fplugin-opt Plutus.Tx.Plugin:defer-errors.
(From https://plutus-apps.readthedocs.io/en/latest/plutus/troubleshooting.html#plugin-errors)

6086: <p>Aim: document a repo with plutus code using haddock.</p>
<p>Problem: Naively running <code>cabal haddock</code> has a problem that seems to be caused by plutus (on-chain) code.</p>
<p>For example, plutus-pioneer-program <a href="https://github.com/input-output-hk/plutus-pioneer-program/tree/main/code/week03" rel="nofollow noreferrer">week03</a> runs in the repl with <code>cabal repl</code>, but <code>cabal haddock</code> errors as follows.</p>
<pre><code>Haddock coverage:
GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable Ledger.Typed.Scripts.Validators.wrapValidator
            No unfolding
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum @ ()
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
                           @ ()
                           Week03.Homework1.$fUnsafeFromDataVestingDatum
Context: Compiling expr: Ledger.Typed.Scripts.Validators.wrapValidator
                           @ Week03.Homework1.VestingDatum
                           @ ()
                           Week03.Homework1.$fUnsafeFromDataVestingDatum
                           PlutusTx.IsData.Instances.$fUnsafeFromData()
Context: Compiling expr at &quot;plutus-pioneer-program-week03-0.1.0.0-inplace:Week03.Homework1:(60,8)-(60,37)&quot;
cabal: Failed to build documentation for
plutus-pioneer-program-week03-0.1.0.0.
</code></pre>
<p>Is there a straightforward way to build haddock docs for repos with plutus code?</p>
 6292: <p>Yes! Try <code>cabal haddock -fplugin-opt Plutus.Tx.Plugin:defer-errors</code>.</p>
<p>(From <a href="https://plutus-apps.readthedocs.io/en/latest/plutus/troubleshooting.html#plugin-errors" rel="nofollow noreferrer">https://plutus-apps.readthedocs.io/en/latest/plutus/troubleshooting.html#plugin-errors</a>)</p>
