jxxcarlson/elm-review-codeinstaller/13.0.0

Install.TypeVariant

Add a variant to a given type in a given module. As in the ReviewConfig item below, you specify the module name, the type name, and the type of the new variant.

Install.TypeVariant.config
    "Types"
    "ToBackend"
    [ "ResetCounter" "SetCounter Int" ]
    |> Install.typeVariant

Then you will have

 type ToBackend
     = CounterIncremented
     | CounterDecremented
     | ResetCounter
     | SetCounter Int

where the last two variants are the ones added.

config : String -> String -> List String -> Config

Create a rule that adds variants to a type in a specified module:

Install.TypeVariant.config
    "Types"
    "ToBackend"
    [ "ResetCounter", "SetCounter: Int" ]
    |> Install.typeVariant
type alias Config =
Config

Configuration for rule.