Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Opaque types, named constants, no defaults in Nbfi.scala#98

Merged
speedcom merged 1 commit intomainfrom
refactor/nbfi-quality
Mar 10, 2026
Merged

Opaque types, named constants, no defaults in Nbfi.scala#98
speedcom merged 1 commit intomainfrom
refactor/nbfi-quality

Conversation

@speedcom
Copy link
Contributor

Summary

  • State: removed 7 defaults — all 13 fields explicit
  • zero: defval in object State companion
  • initial: removed redundant PLN(x.toDouble) wrapping
  • step: wage/domesticConsPLN, unempRate/bankNplRatioRatio, yields/returns/depositRate → Rate
  • Helper methods: bankTightness(Ratio) → Ratio, tfiInflow → PLN, nbfiOrigination/Repayment/Defaults take PLN/Ratio, return PLN
  • 6 named constants extracted (NplTightnessFloor, NplTightnessRange, UnempDefaultThreshold, ExcessReturnSens, ExcessReturnCap, MonthsPerYear)
  • Tests: mkStep helper, opaque type assertions throughout

5 files, −129/+193. Pure refactoring, no behavioral changes.

Test plan

  • sbt test — 1245 tests pass
  • Zero var, zero field defaults in Nbfi.scala

- State: remove 7 defaults, all 13 fields explicit
- zero: def → val in object State companion
- initial: remove redundant PLN wrapping
- step: wage/domesticCons → PLN, unempRate/bankNplRatio → Ratio,
  yields/returns/depositRate → Rate
- Helper methods: bankTightness(Ratio)→Ratio, tfiInflow → PLN,
  nbfiOrigination/Repayment/Defaults take PLN/Ratio, return PLN
- Extract 6 named constants (NplTightnessFloor/Range,
  UnempDefaultThreshold, ExcessReturnSens/Cap, MonthsPerYear)
- Tests: mkStep helper, opaque type assertions
@speedcom speedcom merged commit 3f397ed into main Mar 10, 2026
2 checks passed
@speedcom speedcom deleted the refactor/nbfi-quality branch March 10, 2026 18:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant