Add -fwan-sum-type-partial-field-accessor
This a a new warning flag that would be off by default and warns when a sum type is defined with field accessors that are partial. For an example of something that would trigger the warning:
data Option a
= Some { getSome :: a }
| None
In production quality Haskell code it usually desirable to outright ban partial functions like head
, fromJust
etc by use of a custom prelude. Unfortunately partial functions can still sneak into a code base via field accessors in sum types.
Trac metadata
Trac field | Value |
---|---|
Version | 8.4.3 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |