Custom type constructors can contain data that is never extracted out of the constructor.
This rule will warn arguments that are always pattern matched using a wildcard (_).
For package projects, custom types whose constructors are exposed as part of the package API are not reported.
Fail
type CustomType
= CustomType Used Unused
case customType of
CustomType value _ -> value
Success
type CustomType
= CustomType Used Unused
case customType of
CustomType value maybeUsed -> value
When not to enable this rule?
If you like giving names to all arguments when pattern matching, then this rule will not found many problems.
This rule will work well when enabled along with NoUnused.Patterns.
Try it out
You can try this rule out by running the following command:
Reports arguments of custom type constructors that are never used.
Custom type constructors can contain data that is never extracted out of the constructor. This rule will warn arguments that are always pattern matched using a wildcard (
_).For package projects, custom types whose constructors are exposed as part of the package API are not reported.
Fail
Success
When not to enable this rule?
If you like giving names to all arguments when pattern matching, then this rule will not found many problems. This rule will work well when enabled along with
NoUnused.Patterns.Try it out
You can try this rule out by running the following command: