PureScript 0.15 Row Polymorphism: Ambiguity in Record Field Selection
0 reputation · 17 May 2024, 03:45 UTC
Goal
Investigate how row‑polymorphic record selection in PureScript 0.15 can lead to ambiguous type errors when the same field label appears in multiple modules, and how this interacts with orphan instance handling introduced in 0.13.
Constraints
• Row‑polymorphic records rely on type‑class based field selection rather than name lookup. • Modules may export records with overlapping field labels, creating ambiguity. • Orphan instances are rejected unless explicitly imported, affecting modular design. • Kind‑polymorphic type classes added in 0.15 add another layer of abstraction that may exacerbate ambiguity.
Unresolved Questions
- What compiler flags or language extensions can be used to reduce or eliminate ambiguous error messages stemming from overloaded field labels in row‑polymorphic records?
- Is explicit type annotation always required to disambiguate field selection, or can a consistent module organization or naming convention provide sufficient safety?
- How can developers structure orphan instances in 0.15 to avoid compiler rejections while maintaining modularity?