Arkham / elm-review-no-missing-type-constructor / NoMissingTypeConstructor

Imagine you have a type like this:

type Color
    = Red
    | Green
    | Blue

And a definition like this:

allColors : List Color
allColors =
    [ Red, Green ]

This elm-review rule will report a warning because allColors does not have all the possible constructors, since it's missing the Blue variant.

The following will also get reported*:

allColors : Nonempty Color
allColors =
    Nonempty Red [ Green ]

*The rule is built with mgold/elm-nonempty-list in mind but any nonempty list package should work so long as it has a Nonempty or NonEmpty type and the list is constructed with functionOrValue VariantA [ ... ]

Rule

rule : Review.Rule.Rule

Usage

After adding elm-review to your project, import this rule to ReviewConfig.elm file and add it to the config.

Example configuration

import NoMissingTypeConstructor
import Review.Rule exposing (Rule)

config : List Rule
config =
    [ NoMissingTypeConstructor.rule ]