e8f93447

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Self-weed: report unused configured roots, root-instances and root-modules

Weeder now reports configuration entries that no longer match anything,
treating stale roots as weeds in their own right (issue #154):

  * a `roots` pattern that matches no declaration,
  * a `root-instances` entry that matches no instance, and
  * a `root-modules` pattern that matches no module.

These print alongside the regular weeds and contribute to the
weeds-found exit code.

Only entries the user explicitly configured are reported -- defaults
(`Main.main`, `^Paths_.*`, `IsString`/`IsList`) are left alone, since
flagging a default the user never wrote is not actionable. Provenance is
tracked by a `Configured` wrapper on the three root fields, set from
whether the TOML field was present.

A `roots` pattern counts as matching if it names any declaration defined
in the analysed modules (`localDeclarations`), not merely an outputable
one, so a root naming a real type or constructor is not flagged just
because `unused-types` is disabled; a root matching only an external
symbol still is. When `type-class-roots` is set, `root-instances` is
ignored entirely and so is never reported.

To name the offending entry, compiled patterns carry their source string
(`CompiledRegex`), and reachability and dead-root detection share a
single `matchesInstancePattern` predicate.

Adds SelfWeeding and DefaultsNotReported integration tests; no existing
golden output changes.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 2m34s 2s 2s 2m36s 2m34s
Eval 17m43s 3h23m13s 4h55m55s 5h13m38s 3h47m49s
Build 5h13m27s 58s 58s 5h14m25s 0s
Suite 2m34s 3h24m14s 5h11m51s 5h14m25s 3h50m23s

Timeline

0s18m19m20m21m22m23m24m25m26m27m28m29m30m31m32m33m34m35m36m37m38m39m40m41m42m43m44m45m46m47m48m49m50m51m52m53m54m55m56m57m58m59m1h0m1h1m1h2m1h3m1h4m1h5m1h6m1h7m1h8m1h9m1h10m1h11m1h12m1h13m1h14m1h15m1h16m1h17m1h18m1h19m1h20m1h21m1h22m1h23m1h24m1h25m1h26m1h27m1h28m1h29m1h30m1h31m1h32m1h33m1h34m1h35m1h36m1h37m1h38m1h39m1h40m1h41m1h42m1h43m1h44m1h45m1h46m1h47m1h48m1h49m1h50m1h51m1h52m1h53m1h54m1h55m1h56m1h57m1h58m1h59m2h0m2h1m2h2m2h3m2h4m2h5m2h6m2h7m2h8m2h9m2h10m2h11m2h12m2h13m2h14m2h15m2h16m2h17m3h51m3h52m3h53m3h54m3h55m3h56m3h57m3h58m3h59m4h0m4h1m4h2m4h3m4h4m4h5m4h6m4h7m4h8m4h9m4h10m4h11m4h12m4h13m4h14m4h15m4h16m4h17m4h18m4h19m4h20m4h21m4h22m4h23m4h24m4h25m4h26m4h27m4h28m4h29m4h30m4h31m4h32m4h33m4h34m4h35m4h36m4h37m4h38m4h39m4h40m4h41m4h42m4h43m4h44m4h45m4h46m4h47m4h48m4h49m4h50m4h51m4h52m4h53m4h54m4h55m4h56m4h57m4h58m4h59m5h0m5h1m5h2m5h3m5h4m5h5m5h6m5h7m5h8m5h9m5h10m5h11m5h12m5h13m5h14m