Enforces listing all specific cases if possible
config = [ NoCatchAllForSpecificRemainingPatterns.rule { onlyReportCatchAllIfEquivalentToSinglePattern = True } ]
type Resource = Loaded String | FailedToLoad String | Loading -- with any configuration displayResource : Resource -> Ui displayResource resource = case resource of Loaded text -> Ui.text text FailedToLoad error -> Ui.error error _ -> Ui.spinner -- only with { onlyReportCatchAllIfEquivalentToSinglePattern = False } resourceIsLoaded : Resource -> Bool resourceIsLoaded resource = case resource of Loaded _ -> True _ -> False
-- with any configuration resourceIsLoaded : Resource -> Bool resourceIsLoaded resource = case resource of Loaded _ -> True FailedToLoad _ -> False Loading -> False -- only with { onlyReportCatchAllIfEquivalentToSinglePattern = True } displayResource : Resource -> Ui displayResource resource = case resource of Loaded text -> Ui.text text _ -> Ui.spinner
This works for variant, list and cons patterns.
Enforces listing all specific cases if possible
reported
allowed
This works for variant, list and cons patterns.