<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>

CC BY-SA 4.0
2022-01-31T15:21:03.860Z
Editing the `cabal.project` file as the link suggests gets `cabal haddock` working so I'm good. Passing cli arguments as suggested above or in the docs linked gives an error: `cabal: Unrecognised target 'PlutusTx.Plugin:defer-errors'.
Expected a module name, rather than 'defer-errors'.`
I tried various perturbations such as `Plutus.Tx...`
waalge
CC BY-SA 4.0
2022-01-31T12:52:21.243Z
2022-01-31T12:52:21.243Z
Sjoerd Visscher
<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>

<plutus-pioneer-program><documentation>
Running `cabal haddock` on a repo with plutus code errors
# Running `cabal haddock` on a repo with plutus code errors

(Asked by: username_0 on 2022-01-28)

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?

**Tags:** plutus-pioneer-program, documentation

---

## 1 answers

### Answer by username_1 on 2022-01-31. Score: 3 | Accepted answer

Yes! Try `cabal haddock -fplugin-opt Plutus.Tx.Plugin:defer-errors`.

(From <https://plutus-apps.readthedocs.io/en/latest/plutus/troubleshooting.html#plugin-errors>)

> **Comments:**
> **username_0**: Editing the `cabal.project` file as the link suggests gets `cabal haddock` working so I'm good. Passing cli arguments as suggested above or in the docs linked gives an error: `cabal: Unrecognised target 'PlutusTx.Plugin:defer-errors'. Expected a module name, rather than 'defer-errors'.` I tried various perturbations such as `Plutus.Tx...`  

---

