jxxcarlson/elm-review-codeinstaller/1.1.2

NOTE: the latest version is 13.0.0

Install.ClauseInCase

Add a clause to a case expression in a specified function in a specified module. For example, if you put the code below in your ReviewConfig.elm file, running elm-review will add the clause ResetCounter to the updateFromFrontend function in the Backend module.

-- code for ReviewConfig.elm:
Install.ClauseInCase.makeRule
    "Backend"
    "updateFromFrontend"
    "ResetCounter"
    "( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )"


Thus we will have


updateFromFrontend : SessionId -> ClientId -> ToBackend -> Model -> ( Model, Cmd BackendMsg )
updateFromFrontend sessionId clientId msg model =
    case msg of
        CounterIncremented ->
        ...


        ResetCounter ->
            ( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )
makeRule : String -> String -> String -> String -> Rule

Create a rule that adds a clause to a case expression in a specified function