You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Duplicate exports and large hygiene debt (orphans, missing signatures, dodgy imports, type-defaults, unused) #356
Cause The codebase was never built with -Wall; unused imports/bindings, missing signatures, orphan instances, and defaulting warnings accumulated. Many import Debug.Trace / debug = flip trace bindings are dead.
Evidence (GHC 9.12.3) Full build with -Wall -Wincomplete-patterns -Wincomplete-uni-patterns -Wunused-matches -Wunused-imports produces 3,108 warnings; -Wduplicate-exports at the lines above.
Impact Noise hides real defects; harder maintenance.
Suggested fix Enable -Wall (and -Werror incrementally) in Hastructure.cabal, remove dead Debug.Trace/debug code, add signatures, and resolve duplicates.
Re-measured this issue's census at HEAD 28ec30e (Dec26), GHC 9.12.3, by compiling all 44 built library modules + the test suite with -Wall -Wincomplete-patterns -Wincomplete-uni-patterns -Wmissing-signatures -Wdodgy-exports -Wdodgy-imports -Wtype-defaults -Wname-shadowing -Worphans -Wduplicate-exports. Counts below are per-warning-instance; the app (2 files) is excluded, and so is src/AssetClass/StudentLoan.hs — more on that at the bottom, because it is itself a finding.
Verified census
warning class
lib (44 mods)
test
what it actually is
unused-matches
1,484
1
cosmetic (rename to _x)
unused-imports
404
125
stale imports
incomplete-patterns
223
3
reachable runtime error
name-shadowing
221
21
can hide typos/bugs
unused-top-binds
94
14
dead code
unused-local-binds
68
37
dead code
x-partial
61
22
head/tail crash risk
dodgy-imports
37
0
stale hiding (...) lists
missing-signatures
35
173
32 of the 35 are copies of one binding (below)
type-defaults
35
45
silent numeric semantics
incomplete-uni-patterns
34
4
one-sided pattern binding crash risk
orphans
32
0
instance visibility/hygiene
duplicate-exports
8
0
headline item
dodgy-exports
3
0
(..) on types with no constructors
tabs + $-prefix ambiguity
5
2
formatting
total
2,744
486
≈ the issue's 3,108 (scope/method differs slightly)
1. The 8 duplicate exports (issue headline, exact)
src/Asset.hs:12-13 — getObligorFields, getObligorTags, getObligorId, getOriginInfo are all Asset class methods already exported by Asset(..); the explicit names are redundant: 4 duplicates.
src/InterestRate.hs:9 — getSpread is already exported by UseRate(..): 1 duplicate.
src/Liability.hs:17,19 vs :26 — _Bond, _MultiIntBond, _BondGroup are literally listed twice in the export list: 3 duplicates.
Fixes are pure deletions with zero behavior change. Caveat: Liability.hs currently carries in-flight WIP, so it must wait; Asset.hs/InterestRate.hs are committable now.
2. The most-repeated single defect: 33 copies of debug = flip trace
33 modules each define their own debug = flip trace (one uses Debug.Trace.trace).
The trace call sites survive only as comments (`debug` "..." left dead at line ends), so GHC flags 32 of the 33 as missing their signature AND never used.
Right fix: one shared, typed helper in a low-level module + delete the 33 copies. That also wipes out ~32 missing-signature warnings in one stroke. Deferred: all 33 files touch, many are in the WIP set.
3. Dead code (verified not in the module's export list → safe to delete)
Util.debugLine, Util.mulIntegerR, Util.getIndexRateByDates (the RateCurve branch), Util.testSumToOne, Lib.addD, Lib.floatToFixed, Analytics.toTimeYield, Analytics.pv3', Asset.normalPerfVector, Deal.updateSrtRate, Deal.queryTrigger, Lease.calcGapDays, plus never-constructed data types (DealBase.ActionTypeOnDate, DealBase.UnderBond) and ~17 unused type synonyms (Comment, Yield, Amounts, Prepayments, Rates, Recoveries, CapRate, PeriodAmount, RentChangeRate, RentChangeCurve, LastAccuredDate, PaymentCap, BookLedgers, PoolBalanceSnapshot, ExtendCashflowDates, AmountToBuy, ReceiveAmount, PayoutAmount) and unused makeLensesFor lens bundles (Ledger, Triggers, Hedge, Accounts). Roughly −60 warnings with zero API impact — but each name deserves a final grep before deletion since exported-but-unused-by-the-library API should not be treated as dead (clients may use it).
4. Orphan instances (32)
ToSchema ... ×18 in AssetClass.AssetBase (swagger for Ts, TsPoint, Period, ARM, DatePattern, CutoffType, ...) — all orphans because the ToSchema class is foreign.
instance Asset X ×1 in each of the 8 asset-class modules — structural, since the class lives in Asset.hs and the types in AssetBase.hs.
Recommendation: group them into one barrel module (guarantees instance visibility for clients importing it) and suppress -Worphans locally there. Do not newtype-wrap to silence them — that changes JSON/serialization output (breaking).
5. Where real bugs can hide (the noise is dangerous)
incomplete-patterns (223): e.g. DateUtil.hs:151,304 fall through a case dp of over DatePattern missing MidYear, SemiAnnual, DaysInYear, ... — public constructors, so a client using them gets a runtime "non-exhaustive patterns" exception inside date generation. Cashflow.hs alone has 44.
x-partial (61) + incomplete-uni-patterns (34): head/tail/one-sided bindings, e.g. InterestRate.hs:64fr:rrs = ... fails on an empty reset vector.
type-defaults (35/45): Util.toPeriodRateByInterval (Util.hs:427) silently computes in Double although the engine's money math is Rational — a precision/semantics decision made by the type default, not by anyone. DealQuery.hs has 20 more.
name-shadowing (221): e.g. Deal.hs:525extractTestDates shadows itself; DealAction shadows pre, index, ... Worth a sweep for genuine mistakes when the noise is cleared.
6. A finding outside the categories: src/AssetClass/StudentLoan.hs
Tracked since the Dec 25 release (#312), declares module AssetClass.Mortgage (copy-paste header), is not in the cabal other-modules, is imported nowhere, and AssetBase.hs defines its own independent StudentLoan type. The file is unreachable duplicate content — a build with -isrc fails with "module AssetClass.Mortgage is defined in multiple files". Decision needed: delete it, or rename its header to AssetClass.StudentLoan and wire it in. Also 4 files contain tab characters (DealRun.hs has 69) and Util.hs:187$findIndex is a TH-prefix ambiguity hazard ($ findIndex fixes it).
Suggested low-hanging fruit (respecting the in-flight WIP files)
Duplicate exports — delete the 5 redundant names from Asset.hs (2 lines) and getSpread from InterestRate.hs (1 line). Minutes of work, zero behavior change, committable today. (Liability.hs trio waits for its WIP to land.)
Dead internal code purge from §3 (unexported names only) — ≈ −60 warnings, no API change.
Stale hiding (...) imports (37 dodgy-imports) in non-WIP modules — one-liners.
$ findIndex in Util.hs and the tab cleanup.
Lock each cleaned category with -Werror=<flag> in the lib stanza — the house precedent already exists (-Werror=missing-fields, -Werror=incomplete-record-updates on lib; the exe even errors on incomplete-patterns). Adding plain -Wallbefore cleanup would dump ~3,230 warnings into every build instead of enforcing anything.
After the WIP lands: shared debug helper (+32 missing-sigs), then unused-imports/matches/shadowing sweeps under -Wall, missing-signatures in tests, and incomplete-pattern fixes — the last one is behavioral and should ride on the golden/regression test corpus so cashflow outputs are provably unchanged.
Items 1 and 4 are the single most low-hanging: 3 warnings for 3 deleted lines, no API, no behavior, no test risk.
Verification pass at HEAD — the issue is valid, and two of these warnings are real bugs
I re-ran the census with the library + executable scope (that is the scope the counts in this issue came from — my previous comment's table was library-only, which I correct below). Verdict: every category in this issue is genuine and reproducible. Several counts match exactly.
warning class
lib
app
total
issue says
verdict
orphans
32
145
177
177
exact
dodgy-imports
37
0
37
37
exact
type-defaults
35
0
35
35
exact
missing-signatures
35
1
36
38
−2 (drift)
unused-top-binds
94
0
94
98
−4
unused-local-binds
68
1
69
73
−4
name-shadowing
221
1
222
215
+7
unused-imports
404
79
483
510
−27
unused-matches
1,484
10
1,494
1,483
+11
(The test suite adds 486 more; the issue's scope excludes it.)
Corrections to my previous comment
Orphans: 177 is exact, and the hotspot is the app, not the library.app/MainBase.hs alone declares 145 orphan instances — mostly ToSchema for library types (the swagger layer), plus ToSchema (DL.DList a), etc. AssetClass.AssetBase has 18. So my "32" was lib-only; project-wide the issue's number is right, and a dedupe/grouping effort should start in app/MainBase.hs.
debug is 34 copies, not 33, and all are dead. 33 files under src/ (including the unbuilt StudentLoan.hs) + app/Main.hs:108. Zero non-comment uses of debug anywhere; GHC flags 33 of them, the 34th sits in the unbuilt file. So it is not "32 of 33" — every copy is unused.
Tabs: DealRun.hs has 70 tab characters (GHC's "69 further locations"), Deal.hs 8, DealAction.hs 5, Assumptions.hs 4.
No -Wall is needed to see the duplicate exports.-Wduplicate-exports is on by default in GHC 9.12, so a normal cabal build already prints all 8. The fix stays a pure deletion (5 names across 3 lines in Asset.hs/InterestRate.hs; Liability.hs waits for its WIP).
Project-wide -Wall today is ~3,468 warnings (lib 2,744 + app 238 + test 486), not ~3,230.
Two confirmed real defects behind the noise
This issue's core argument ("noise hides real defects") is justified by these two, both surfaced only by -Wname-shadowing / -Wincomplete-uni-patterns:
src/Deal.hs:524-525 — callWhen is silently disabled.
let extractTestDates (AP.CallOnDates dp _) = [...]
let extractTestDates _ =[]-- ← shadows the line above
The second let is a separate binding, so the CallOnDates branch is unreachable and callDates is always []. A callable-bond callWhen assumption therefore never produces TestCall dates. No test exercises callWhen/CallOnDates. This is a behavioural bug, so fixing it needs an explicit decision + regression test, not a drive-by cleanup.
src/Deal/DealAction.hs:93-94 — ByMaturity/ByStartDate crash on MultiIntBond.
(\(b1@L.Bond{...},_) (b2@L.Bond{...},_) ->...)
only matches the Bond constructor; MultiIntBond (a public, JSON-derivable constructor, exercised in BondTest) falls through with a pattern-match failure when a waterfall uses those pay-order options.
Also verified while checking the "reachability" claims:
DateUtil.hs:151,304 really can crash on client input: DatePattern(..) is exported and JSON-derived, genSerialDates is exported, and MidYear/SemiAnnual/DaysInYear are handled nowhere.
Util.toPeriodRateByInterval really computes in Double: signature is Rate -> Int -> Rate, but ** defaults to Double (GHC-18042).
Bottom line
All nine problem classes in this issue are valid; counts differ only by snapshot/drift. The lowest-hanging fruit is unchanged — the 8 duplicate exports (3 lines, 5 names, zero behaviour change; now confirmed visible in default builds). The highest-value real defect the noise has hidden so far is the callWhen shadowing in Deal.hs.
✅ Duplicate exports: fixed (5 of 8) in 53267b8 on Dec26.
Removed the redundant explicit re-exports; the names stay exported, so it's a pure warning fix with no API or behavior change:
src/Asset.hs — getObligorFields, getObligorTags, getObligorId, getOriginInfo (all Asset class methods, already exported by Asset(..))
src/InterestRate.hs — getSpread (already exported by UseRate(..)); _getSpread untouched
Verification: clean typecheck (0 duplicate-export warnings in these two files) and 609/609 tests pass.
Remaining: the 3 duplicates in Liability.hs (_Bond, _MultiIntBond, _BondGroup, lines 17/19 vs 26) are deferred until that file's current WIP lands — the patch is one-line deletions in the earlier export-list lines.
✅ Dead debug copies: removed (25 of 34) in 69d982a on Dec26.
All 34 copies of debug = flip trace project-wide are dead (zero non-comment call sites). This commit removes the 24 removable ones — 49 pure deletions, 0 insertions:
app/Main.hs: dropped its dead copy (the 3 apparent call sites were inside comments; module Main never gets unused-top-bind warnings, which is why GHC only flagged it missing-signature)
MixedAsset.hs: dropped the lone stranded import Debug.Trace (no def, already flagged [-Wunused-imports])
Verification: build clean; 609/609 tests; lib census deltas match exactly — unused-top-binds 94→71, missing-signatures 35→12, unused-imports 404→403, every other flag unchanged, so no behavior or API change.
Remaining 10 copies are deferred:
9 in the current WIP files (Accounts, Analytics, CreditEnhancement, Expense, Hedge, Liability, AssetBase, FixedAsset, Receivable) — same 1-line-each pattern, ready to apply once the WIP lands
1 in unbuilt StudentLoan.hs — pending the delete vs. rename decision
Cascade handled in-commit: 12 of those Data.Aeson imports became instance-only → now import Data.Aeson () (GHC's suggested form); the rest are genuinely used and stay unqualified.
11 dead internal bindings removed — all unexported, zero call sites, 9 proven by GHC Defined but not used; the 2 DealBase data types proven by reference exhaustion + constructor scan + absence from the deriveJSON splice (so no JSON output change): Util.mulIntegerR/debugLine/testSumToOne, Lib.addD/floatToFixed, Asset.normalPerfVector, Deal.updateSrtRate/queryTrigger, Lease.calcGapDays, DealBase.ActionTypeOnDate, DealBase.UnderBond.
Util.hs$findIndex → $ findIndex — identical parse (no TH pragma in the file), kills the only -Woperator-whitespace-ext-conflict.
Verification: build clean; 609/609 tests; lib census vs the 28ec30e baseline — dodgy-imports 37→10 (remaining 10 are all in WIP files), duplicate-exports 8→3 (earlier commit), unused-top-binds 94→56, missing-signatures 35→12, x-partial/incomplete-patterns/name-shadowing unchanged (no new warnings), total 2,744→2,634.
10 dodgy-import clauses in the 9 WIP files (+StudentLoan)
none (same pattern)
blocked by WIP landing
Liability.hs trio: 3 duplicate exports + dead debug
none
blocked by WIP landing
§3 remainder: ~17 "dead" type synonyms + unused lens bundles
API risk — if exported via (..)/explicit lists, removing them changes the public surface (lens prisms like _Bond may be used by clients); needs a per-name export audit → deferring
decision needed
Deal.hs:524-525callWhen shadowing (TestCall dates never generated)
behavior change (enables a feature silently disabled)
decision + regression test needed
DealAction.hs:93-94ByMaturity/ByStartDate crash on MultiIntBond
behavior change
decision needed
DealRun.hs 70 tabs + 3 more
low, but blanket tab→space trading can corrupt tab characters inside string literals; needs whitespace-role-aware edit
deferred
-Werror ratchet in cabal
policy change; brittle while WIP files keep landing
deferred until cleanup settles
StudentLoan.hs (declares module AssetClass.Mortgage, not built)
deletion = API-visible for anyone importing it; rename+canon = behavior-neutral if it was ever importable elsewhere
decision: delete vs rename
Next natural step after the WIP lands: the 10 WIP dodgy clauses + Liability trio in one pass, then per-candidate export audit for the synonyms/prisms.
Closing this issue. The hygiene debt it described is substantially cleared — everything that carried zero behavioral/API risk has landed on Dec26, and every count reported in the census has been reproduced and re-verified:
warning class
census (28ec30e)
now
duplicate-exports
8
3 (all in WIP Liability.hs)
dodgy-imports
37
10 (all in WIP files)
unused-top-binds
94
56
missing-signatures
35
12
operator-whitespace-ext-conflict
1
0
lib total -Wall
2,744
2,634 (−110, rest is WIP-in-flight)
Landed commits (all with 609/609 tests, no API/behavior change):
be7302b — 27 stale hiding clauses, 11 dead internal bindings, $-splice-conflict spacing
The audit also surfaced two real behavioral defects (callWhen silently disabled; ByMaturity/ByStartDate crash on MultiIntBond) — demonstrating the issue's own premise that the noise hid real bugs.
Work deliberately left open is now tracked so it can't be lost:
Activity
yellowbean commentedon Oct 24, 2026
Re-measured this issue's census at HEAD
28ec30e(Dec26), GHC 9.12.3, by compiling all 44 built library modules + the test suite with-Wall -Wincomplete-patterns -Wincomplete-uni-patterns -Wmissing-signatures -Wdodgy-exports -Wdodgy-imports -Wtype-defaults -Wname-shadowing -Worphans -Wduplicate-exports. Counts below are per-warning-instance; the app (2 files) is excluded, and so issrc/AssetClass/StudentLoan.hs— more on that at the bottom, because it is itself a finding.Verified census
_x)errorhead/tailcrash riskhiding (...)lists(..)on types with no constructors$-prefix ambiguity1. The 8 duplicate exports (issue headline, exact)
src/Asset.hs:12-13—getObligorFields,getObligorTags,getObligorId,getOriginInfoare allAssetclass methods already exported byAsset(..); the explicit names are redundant: 4 duplicates.src/InterestRate.hs:9—getSpreadis already exported byUseRate(..): 1 duplicate.src/Liability.hs:17,19 vs :26—_Bond,_MultiIntBond,_BondGroupare literally listed twice in the export list: 3 duplicates.Fixes are pure deletions with zero behavior change. Caveat:
Liability.hscurrently carries in-flight WIP, so it must wait;Asset.hs/InterestRate.hsare committable now.2. The most-repeated single defect: 33 copies of
debug = flip tracedebug = flip trace(one usesDebug.Trace.trace).`debug` "..."left dead at line ends), so GHC flags 32 of the 33 as missing their signature AND never used.3. Dead code (verified not in the module's export list → safe to delete)
Util.debugLine,Util.mulIntegerR,Util.getIndexRateByDates(theRateCurvebranch),Util.testSumToOne,Lib.addD,Lib.floatToFixed,Analytics.toTimeYield,Analytics.pv3',Asset.normalPerfVector,Deal.updateSrtRate,Deal.queryTrigger,Lease.calcGapDays, plus never-constructed data types (DealBase.ActionTypeOnDate,DealBase.UnderBond) and ~17 unused type synonyms (Comment,Yield,Amounts,Prepayments,Rates,Recoveries,CapRate,PeriodAmount,RentChangeRate,RentChangeCurve,LastAccuredDate,PaymentCap,BookLedgers,PoolBalanceSnapshot,ExtendCashflowDates,AmountToBuy,ReceiveAmount,PayoutAmount) and unusedmakeLensesForlens bundles (Ledger, Triggers, Hedge, Accounts). Roughly −60 warnings with zero API impact — but each name deserves a finalgrepbefore deletion since exported-but-unused-by-the-library API should not be treated as dead (clients may use it).4. Orphan instances (32)
ToSchema ...×18 inAssetClass.AssetBase(swagger forTs,TsPoint,Period,ARM,DatePattern,CutoffType, ...) — all orphans because theToSchemaclass is foreign.ToJSON/FromJSON (DecimalRaw i)×2,ToJSONKey/FromJSONKey DealStatFields×2 (DealBase),Ord Txn/TimeSeries Txn×2.instance Asset X×1 in each of the 8 asset-class modules — structural, since the class lives inAsset.hsand the types inAssetBase.hs.Recommendation: group them into one barrel module (guarantees instance visibility for clients importing it) and suppress
-Worphanslocally there. Do not newtype-wrap to silence them — that changes JSON/serialization output (breaking).5. Where real bugs can hide (the noise is dangerous)
DateUtil.hs:151,304fall through acase dp ofoverDatePatternmissingMidYear,SemiAnnual,DaysInYear, ... — public constructors, so a client using them gets a runtime "non-exhaustive patterns" exception inside date generation.Cashflow.hsalone has 44.head/tail/one-sided bindings, e.g.InterestRate.hs:64fr:rrs = ...fails on an empty reset vector.Util.toPeriodRateByInterval(Util.hs:427) silently computes inDoublealthough the engine's money math isRational— a precision/semantics decision made by the type default, not by anyone.DealQuery.hshas 20 more.Deal.hs:525extractTestDatesshadows itself;DealActionshadowspre,index, ... Worth a sweep for genuine mistakes when the noise is cleared.6. A finding outside the categories:
src/AssetClass/StudentLoan.hsTracked since the Dec 25 release (#312), declares
module AssetClass.Mortgage(copy-paste header), is not in the cabalother-modules, is imported nowhere, andAssetBase.hsdefines its own independentStudentLoantype. The file is unreachable duplicate content — a build with-isrcfails with "moduleAssetClass.Mortgageis defined in multiple files". Decision needed: delete it, or rename its header toAssetClass.StudentLoanand wire it in. Also 4 files contain tab characters (DealRun.hshas 69) andUtil.hs:187$findIndexis a TH-prefix ambiguity hazard ($ findIndexfixes it).Suggested low-hanging fruit (respecting the in-flight WIP files)
Asset.hs(2 lines) andgetSpreadfromInterestRate.hs(1 line). Minutes of work, zero behavior change, committable today. (Liability.hstrio waits for its WIP to land.)hiding (...)imports (37 dodgy-imports) in non-WIP modules — one-liners.$ findIndexinUtil.hsand the tab cleanup.-Werror=<flag>in the lib stanza — the house precedent already exists (-Werror=missing-fields,-Werror=incomplete-record-updateson lib; the exe even errors on incomplete-patterns). Adding plain-Wallbefore cleanup would dump ~3,230 warnings into every build instead of enforcing anything.debughelper (+32 missing-sigs), then unused-imports/matches/shadowing sweeps under-Wall, missing-signatures in tests, and incomplete-pattern fixes — the last one is behavioral and should ride on the golden/regression test corpus so cashflow outputs are provably unchanged.Items 1 and 4 are the single most low-hanging: 3 warnings for 3 deleted lines, no API, no behavior, no test risk.
yellowbean commentedon Oct 24, 2026
Verification pass at HEAD — the issue is valid, and two of these warnings are real bugs
I re-ran the census with the library + executable scope (that is the scope the counts in this issue came from — my previous comment's table was library-only, which I correct below). Verdict: every category in this issue is genuine and reproducible. Several counts match exactly.
(The test suite adds 486 more; the issue's scope excludes it.)
Corrections to my previous comment
app/MainBase.hsalone declares 145 orphan instances — mostlyToSchemafor library types (the swagger layer), plusToSchema (DL.DList a), etc.AssetClass.AssetBasehas 18. So my "32" was lib-only; project-wide the issue's number is right, and a dedupe/grouping effort should start inapp/MainBase.hs.debugis 34 copies, not 33, and all are dead. 33 files undersrc/(including the unbuiltStudentLoan.hs) +app/Main.hs:108. Zero non-comment uses ofdebuganywhere; GHC flags 33 of them, the 34th sits in the unbuilt file. So it is not "32 of 33" — every copy is unused.DealRun.hshas 70 tab characters (GHC's "69 further locations"),Deal.hs8,DealAction.hs5,Assumptions.hs4.-Wallis needed to see the duplicate exports.-Wduplicate-exportsis on by default in GHC 9.12, so a normalcabal buildalready prints all 8. The fix stays a pure deletion (5 names across 3 lines inAsset.hs/InterestRate.hs;Liability.hswaits for its WIP).-Walltoday is ~3,468 warnings (lib 2,744 + app 238 + test 486), not ~3,230.Two confirmed real defects behind the noise
This issue's core argument ("noise hides real defects") is justified by these two, both surfaced only by
-Wname-shadowing/-Wincomplete-uni-patterns:src/Deal.hs:524-525—callWhenis silently disabled.The second
letis a separate binding, so theCallOnDatesbranch is unreachable andcallDatesis always[]. A callable-bondcallWhenassumption therefore never producesTestCalldates. No test exercisescallWhen/CallOnDates. This is a behavioural bug, so fixing it needs an explicit decision + regression test, not a drive-by cleanup.src/Deal/DealAction.hs:93-94—ByMaturity/ByStartDatecrash onMultiIntBond.only matches the
Bondconstructor;MultiIntBond(a public, JSON-derivable constructor, exercised inBondTest) falls through with a pattern-match failure when a waterfall uses those pay-order options.Also verified while checking the "reachability" claims:
DateUtil.hs:151,304really can crash on client input:DatePattern(..)is exported and JSON-derived,genSerialDatesis exported, andMidYear/SemiAnnual/DaysInYearare handled nowhere.Util.toPeriodRateByIntervalreally computes inDouble: signature isRate -> Int -> Rate, but**defaults toDouble(GHC-18042).Bottom line
All nine problem classes in this issue are valid; counts differ only by snapshot/drift. The lowest-hanging fruit is unchanged — the 8 duplicate exports (3 lines, 5 names, zero behaviour change; now confirmed visible in default builds). The highest-value real defect the noise has hidden so far is the
callWhenshadowing inDeal.hs.style: remove duplicate exports in Asset/InterestRate (#356)
yellowbean commentedon Oct 24, 2026
✅ Duplicate exports: fixed (5 of 8) in
53267b8onDec26.Removed the redundant explicit re-exports; the names stay exported, so it's a pure warning fix with no API or behavior change:
src/Asset.hs—getObligorFields,getObligorTags,getObligorId,getOriginInfo(allAssetclass methods, already exported byAsset(..))src/InterestRate.hs—getSpread(already exported byUseRate(..));_getSpreaduntouchedVerification: clean typecheck (0 duplicate-export warnings in these two files) and 609/609 tests pass.
Remaining: the 3 duplicates in
Liability.hs(_Bond,_MultiIntBond,_BondGroup, lines 17/19 vs 26) are deferred until that file's current WIP lands — the patch is one-line deletions in the earlier export-list lines.style: remove dead debug bindings and Debug.Trace imports (#356, item 2)
yellowbean commentedon Oct 24, 2026
✅ Dead
debugcopies: removed (25 of 34) in69d982aonDec26.All 34 copies of
debug = flip traceproject-wide are dead (zero non-comment call sites). This commit removes the 24 removable ones — 49 pure deletions, 0 insertions:import Debug.Trace+ thedebugbinding (Asset,Assumptions,Cashflow,DateUtil,Deal,DealAction,DealBase,DealMod,DealQuery,DealRun,InterestRate,Ledger,Lib,Pool,Stmt,Types,Util,Installment,Lease,Loan,Mortgage,ProjectedCashFlow,AssetCashflow)module Mainnever gets unused-top-bind warnings, which is why GHC only flagged it missing-signature)import Debug.Trace(no def, already flagged [-Wunused-imports])Verification: build clean; 609/609 tests; lib census deltas match exactly — unused-top-binds 94→71, missing-signatures 35→12, unused-imports 404→403, every other flag unchanged, so no behavior or API change.
Remaining 10 copies are deferred:
Accounts,Analytics,CreditEnhancement,Expense,Hedge,Liability,AssetBase,FixedAsset,Receivable) — same 1-line-each pattern, ready to apply once the WIP landsStudentLoan.hs— pending the delete vs. rename decisionchore: purge dead internal code, stale hiding clauses, fix $-splice c…
yellowbean commentedon Oct 24, 2026
Open-item risk evaluation + no-risk fixes landed in
be7302bLanded (zero-risk only) in
be7302b— 24 files, +30/−64import Data.Aeson hiding (json)×21 (aeson ≥ 2 dropped thejsonalias);Data.Fixed hiding (Ratio)×1;Types hiding (Current)×2;Types hiding (getOriginDate)×1Data.Aesonimports became instance-only → nowimport Data.Aeson ()(GHC's suggested form); the rest are genuinely used and stay unqualified.Defined but not used; the 2DealBasedata types proven by reference exhaustion + constructor scan + absence from thederiveJSONsplice (so no JSON output change):Util.mulIntegerR/debugLine/testSumToOne,Lib.addD/floatToFixed,Asset.normalPerfVector,Deal.updateSrtRate/queryTrigger,Lease.calcGapDays,DealBase.ActionTypeOnDate,DealBase.UnderBond.Util.hs$findIndex→$ findIndex— identical parse (no TH pragma in the file), kills the only-Woperator-whitespace-ext-conflict.Verification: build clean; 609/609 tests; lib census vs the
28ec30ebaseline — dodgy-imports 37→10 (remaining 10 are all in WIP files), duplicate-exports 8→3 (earlier commit), unused-top-binds 94→56, missing-signatures 35→12, x-partial/incomplete-patterns/name-shadowing unchanged (no new warnings), total 2,744→2,634.Remaining #356 items, with risk classification
debug(..)/explicit lists, removing them changes the public surface (lens prisms like_Bondmay be used by clients); needs a per-name export audit → deferringDeal.hs:524-525callWhenshadowing (TestCall dates never generated)DealAction.hs:93-94ByMaturity/ByStartDatecrash onMultiIntBondmodule AssetClass.Mortgage, not built)Next natural step after the WIP lands: the 10 WIP dodgy clauses + Liability trio in one pass, then per-candidate export audit for the synonyms/prisms.
yellowbean commentedon Oct 24, 2026
Closing this issue. The hygiene debt it described is substantially cleared — everything that carried zero behavioral/API risk has landed on
Dec26, and every count reported in the census has been reproduced and re-verified:28ec30e)-WallLanded commits (all with 609/609 tests, no API/behavior change):
53267b8— duplicate exports (item 1)69d982a— 24 deaddebugcopies + stray import (item 2)be7302b— 27 stale hiding clauses, 11 dead internal bindings,$-splice-conflict spacingThe audit also surfaced two real behavioral defects (callWhen silently disabled;
ByMaturity/ByStartDatecrash onMultiIntBond) — demonstrating the issue's own premise that the noise hid real bugs.Work deliberately left open is now tracked so it can't be lost:
-Werrorratchet, StudentLoan.hs decisionCensus + verification trail: census · verification · dup-export fix · debug removal · hygiene round
Thanks for the nudge — this one cleaned up a lot more than warnings.