[{"name":"Install","comment":"\n\n@docs rule\n\n@docs Installation\n@docs imports, elementToList, function, replaceFunction, clauseInCase, fieldInTypeAlias, initializer, initializerCmd, subscription, customType, typeVariant\n\n","unions":[{"name":"Installation","comment":" A transformation to apply.\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"clauseInCase","comment":" Insert a clause in a `case` expression, defined by [`Install.ClauseInCase.config`](Install-ClauseInCase#config).\n","type":"Install.ClauseInCase.Config -> Install.Installation"},{"name":"customType","comment":" Add a type, defined by [`Install.Type.config`](Install-Type#config).\n","type":"Install.Type.Config -> Install.Installation"},{"name":"elementToList","comment":" Add an element to the end of a list, defined by [`Install.ElementToList.config`](Install-ElementToList#config).\n","type":"Install.ElementToList.Config -> Install.Installation"},{"name":"fieldInTypeAlias","comment":" Insert a field in a type alias, defined by [`Install.FieldInTypeAlias.config`](Install-FieldInTypeAlias#config).\n","type":"Install.FieldInTypeAlias.Config -> Install.Installation"},{"name":"function","comment":" Insert a function, defined by [`Install.Function.InsertFunction.config`](Install-Function-InsertFunction#config).\n","type":"Install.Function.InsertFunction.Config -> Install.Installation"},{"name":"imports","comment":" Add an import, defined by [`Install.Import.config`](Install-Import#config).\n","type":"Install.Import.Config -> Install.Installation"},{"name":"initializer","comment":" Add fields to the body of a function like `init`, defined by [`Install.Initializer.config`](Install-Initializer#config).\n","type":"Install.Initializer.Config -> Install.Installation"},{"name":"initializerCmd","comment":" Add commands to the body of a function like `init`, defined by [`Install.InitializerCmd.config`](Install-InitializerCmd#config).\n","type":"Install.InitializerCmd.Config -> Install.Installation"},{"name":"replaceFunction","comment":" Replace a function, defined by [`Install.Function.ReplaceFunction.config`](Install-Function-ReplaceFunction#config).\n","type":"Install.Function.ReplaceFunction.Config -> Install.Installation"},{"name":"rule","comment":" Create a rule from a list of transformations.\n","type":"String.String -> List.List Install.Installation -> Review.Rule.Rule"},{"name":"subscription","comment":" Add subscriptions, defined by [`Install.Subscription.config`](Install-Subscription#config).\n","type":"Install.Subscription.Config -> Install.Installation"},{"name":"typeVariant","comment":" Add a type variant, defined by [`Install.TypeVariant.config`](Install-TypeVariant#config).\n","type":"Install.TypeVariant.Config -> Install.Installation"}],"binops":[]},{"name":"Install.ClauseInCase","comment":" Add a clause to a case expression in a specified function\nin a specified module. For example, if you put the code below in your\n`ReviewConfig.elm` file, running `elm-review --fix` will add the clause\n`ResetCounter` to the `updateFromFrontend` function in the `Backend` module.\n\n    -- code for ReviewConfig.elm:\n    Install.ClauseInCase.config\n        \"Backend\"\n        \"updateFromFrontend\"\n        \"ResetCounter\"\n        \"( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\"\n        |> Install.ClauseInCase.makeRule\n\nThus we will have\n\n    updateFromFrontend : SessionId -> ClientId -> ToBackend -> Model -> ( Model, Cmd BackendMsg )\n    updateFromFrontend sessionId clientId msg model =\n        case msg of\n            CounterIncremented ->\n            ...\n            CounterDecremented ->\n            ...\n            ResetCounter ->\n                ( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\n\n            ...\n\n@docs Config, config\n\nBy default, the clause will be inserted as the last clause. You can change the insertion location using the following functions:\n\n@docs withInsertAfter, withInsertAtBeginning\n@docs withCustomErrorMessage\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule: add a clause to a case expression in a specified function in a specified module.\n","args":[],"type":"Install.Internal.ClauseInCase.Config"}],"values":[{"name":"config","comment":" Basic config to add a new clause to a case expression. If you just need to add a new clause at the end of the case, you can simply use it with the `makeRule` function like this:\n\n    Install.ClauseInCase.config\n        \"Backend\"\n        \"updateFromFrontend\"\n        \"ResetCounter\"\n        \"( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\"\n        |> Install.ClauseInCase.makeRule\n\nIf you need additional configuration, check the `withInsertAfter` and `withCustomErrorMessage` functions.\n\n","type":"String.String -> String.String -> String.String -> String.String -> Install.ClauseInCase.Config"},{"name":"withCustomErrorMessage","comment":" Customize the error message that will be displayed when running `elm-review --fix` or `elm-review --fix-all`.\n\n    Install.ClauseInCase.config\n        \"Backend\"\n        \"updateFromFrontend\"\n        \"ResetCounter\"\n        \"( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\"\n        |> Install.ClauseInCase.withCustomErrorMessage \"Add handler for ResetCounter\" []\n        |> Install.ClauseInCase.makeRule\n\n","type":"String.String -> List.List String.String -> Install.ClauseInCase.Config -> Install.ClauseInCase.Config"},{"name":"withInsertAfter","comment":" Add a clause after another clause of choice in a case expression. If the clause to insert after is not found, the new clause will be inserted at the end.\n\n\n## Example\n\nGiven the following module:\n\n    module Philosopher exposing (Philosopher(..), stringToPhilosopher)\n\n    type Philosopher\n        = Socrates\n        | Plato\n        | Aristotle\n\n    stringToPhilosopher : String -> Maybe Philosopher\n    stringToPhilosopher str =\n        case str of\n            \"Socrates\" ->\n                Just Socrates\n\n            \"Plato\" ->\n                Just Plato\n\n            \"Aristotle\" ->\n                Just Aristotle\n\n            _ ->\n                Nothing\n\nTo add the clause `Aspasia` after the clause `Aristotle`, you can use the following configuration:\n\n    Install.ClauseInCase.config\n        \"Philosopher\"\n        \"stringToPhilosopher\"\n        \"Aspasia\"\n        \"Just Aspasia\"\n        |> Install.ClauseInCase.withInsertAfter \"Aristotle\"\n        |> Install.ClauseInCase.makeRule\n\nThis will add the clause `Aspasia` after the clause `Aristotle` in the `stringToPhilosopher` function, resulting in:\n\n    stringToPhilosopher : String -> Maybe Philosopher\n    stringToPhilosopher str =\n        case str of\n            \"Socrates\" ->\n                Just Socrates\n\n            \"Plato\" ->\n                Just Plato\n\n            \"Aristotle\" ->\n                Just Aristotle\n\n            \"Aspasia\" ->\n                Just Aspasia\n\n            _ ->\n                Nothing\n\n","type":"String.String -> Install.ClauseInCase.Config -> Install.ClauseInCase.Config"},{"name":"withInsertAtBeginning","comment":" Add a clause at the beginning of the case expression.\n\nYou also can add the clause after another clause of choice with the `withInsertAfter` function:\n\n    Install.ClauseInCase.config\n        \"Backend\"\n        \"updateFromFrontend\"\n        \"ResetCounter\"\n        \"( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\"\n        |> Install.ClauseInCase.withInsertAtBeginning\n        |> Install.ClauseInCase.makeRule\n\nIn this case we will have\n\n    updateFromFrontend : SessionId -> ClientId -> ToBackend -> Model -> ( Model, Cmd BackendMsg )\n    updateFromFrontend sessionId clientId msg model =\n        case msg of\n            ResetCounter ->\n                ( { model | counter = 0 }, broadcast (CounterNewValue 0 clientId) )\n\n            CounterIncremented ->\n            ...\n\n            CounterDecremented ->\n            ...\n\n","type":"Install.ClauseInCase.Config -> Install.ClauseInCase.Config"}],"binops":[]},{"name":"Install.ElementToList","comment":"\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.ElementToList.Config"}],"values":[{"name":"config","comment":" Create a rule that adds elements to a list.\n\nFor example, the rule\n\n    Install.Rule.rule\n        [ Install.ElementToList.config\n            \"User\"\n            \"userTypes\"\n            [ \"Admin\", \"SystemAdmin\" ]\n            |> Install.Rule.elementToList\n        ]\n\nresults in the following fix for function `User.userTypes`:\n\n    [ Standard ] -> [ Standard, Admin, SystemAdmin ]\n\n","type":"String.String -> String.String -> List.List String.String -> Install.ElementToList.Config"}],"binops":[]},{"name":"Install.FieldInTypeAlias","comment":" Add a field to specified type alias\nin a specified module. For example, if you put the code below in your\n`ReviewConfig.elm` file, running `elm-review` will add the field\n`quot: String` to the type alias `FrontendModel` in the `Types` module.\n\n    -- code for ReviewConfig.elm:\n    Install.FieldInTypeAlias.makeRule \"Types\" \"FrontendModel\" [ \"clientName: String\", \"quot: String\" ]\n\nThus we will have\n\n    type alias FrontendModel =\n        { counter : Int\n        , clientId : String\n        , clientName : String\n        , quot : String\n        }\n\n@docs Config, config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.FieldInTypeAlias.Config"}],"values":[{"name":"config","comment":" Create a rule that adds a field to a type alias in a specified module. Example usage:\n\n    module Types exposing (FrontendModel)\n\n    type alias FrontendModel =\n        { counter : Int\n        , clientId : String\n        }\n\nAfter running the rule with the following code:\n\n    Install.FieldInTypeAlias.makeRule \"Types\" \"FrontendModel\" [ \"clientName: String\", \"quot: String\" ]\n\nwe will have\n\n    type alias FrontendModel =\n        { counter : Int\n        , clientId : String\n        , clientName : String\n        , quot : String\n        }\n\n","type":"String.String -> String.String -> List.List String.String -> Install.FieldInTypeAlias.Config"}],"binops":[]},{"name":"Install.Function.InsertFunction","comment":" Add a function in a given module if it is not present.\n\n    -- code for ReviewConfig.elm:\n    rule =\n        Install.Function.InsertFunction.config\n            \"Frontend\"\n            \"view\"\n            \"\"\"view model =\n            Html.text \"This is a test\\\"\"\"\"\n            |> Install.insertFunction\n\nRunning this rule will insert the function `view` in the module `Frontend` with the provided implementation.\n\nThe form of the rule is the same for nested modules:\n\n    rule =\n        Install.Function.InsertFunction.config\n            \"Foo.Bar\"\n            \"earnInterest\"\n            \"hoho model = { model | interest = 1.03 * model.interest }\"\n            |> Install.insertFunction\n\n@docs config\n@docs Config, withInsertAfter\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule: add a function in a specified module if it does not already exist.\n","args":[],"type":"Install.Internal.InsertFunction.Config"}],"values":[{"name":"config","comment":" Initialize the configuration for the rule.\n","type":"String.String -> String.String -> String.String -> Install.Function.InsertFunction.Config"},{"name":"withInsertAfter","comment":" Add the function after a specified declaration. Just give the name of a function, type, type alias or port and the function will be added after that declaration. Only work if the function is being added and not replaced.\n","type":"String.String -> Install.Function.InsertFunction.Config -> Install.Function.InsertFunction.Config"}],"binops":[]},{"name":"Install.Function.ReplaceFunction","comment":" Replace a function in a given module with a new implementation.\n\n    -- code for ReviewConfig.elm:\n    rule =\n        Install.Function.ReplaceFunction.config\n            \"Frontend\"\n            \"view\"\n            \"\"\"view model =\n            Html.text \"This is a test\\\"\"\"\"\n            |> Install.Function.ReplaceFunction.makeRule\n\nRunning this rule will replace the function `view` in the module `Frontend` with the provided implementation.\n\nThe form of the rule is the same for nested modules:\n\n    rule =\n        Install.Function.ReplaceFunction.config\n            \"Foo.Bar\"\n            \"earnInterest\"\n            \"hoho model = { model | interest = 1.03 * model.interest }\"\n            |> Install.Function.ReplaceFunction.makeRule\n\n@docs Config, config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule: replace a function in a specified module with a new implementation.\n","args":[],"type":"Install.Internal.ReplaceFunction.Config"}],"values":[{"name":"config","comment":" Initialize the configuration for the rule.\n","type":"String.String -> String.String -> String.String -> Install.Function.ReplaceFunction.Config"}],"binops":[]},{"name":"Install.Import","comment":" Add import statements to a given module.\nFor example, to add `import Foo.Bar` to the `Frontend` module, you can use the following configuration:\n\n    Install.Rule.rule\n        [ Install.Import.config \"Frontend\"\n            [ Install.Import.module_ \"Foo.Bar\" ]\n            |> Install.Rule.addImport\n        ]\n\nTo add the statement `import Foo.Bar as FB exposing (a, b, c)` to the `Frontend` module, do this:\n\n    Install.Import.config \"Frontend\"\n        [ Install.Import.module_ \"Foo.Bar\"\n            |> Install.Import.withAlias \"FB\"\n            |> Install.Import.withExposedValues [ \"a\", \"b\", \"c\" ]\n        ]\n\nThere is a shortcut for importing modules with no alias or exposed values\n\n    Install.Import.qualified \"Frontend\"\n        [ \"Foo.Bar\", \"Baz.Qux\" ]\n\n@docs config, Config\n@docs ImportData, module_, withAlias, withExposedValues, qualified\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for the rule.\n","args":[],"type":"Install.Internal.Import.Config"},{"name":"ImportData","comment":" The functions config and module\\_ returns values of this type; The functions\nwithAlias and withExposedValues transform values of this type.\n","args":[],"type":"{ moduleToImport : String.String, alias : Maybe.Maybe String.String, exposedValues : Maybe.Maybe (List.List String.String) }"}],"values":[{"name":"config","comment":" Initialize the configuration for the rule.\n","type":"String.String -> List.List { moduleToImport : String.String, alias : Maybe.Maybe String.String, exposedValues : Maybe.Maybe (List.List String.String) } -> Install.Import.Config"},{"name":"module_","comment":" Create a module to import with no alias or exposed values\n","type":"String.String -> Install.Import.ImportData"},{"name":"qualified","comment":" Create a rule that adds import statements to a module with no alias or exposed values. Just pass the module name and the list of modules to import.\n","type":"String.String -> List.List String.String -> Install.Import.Config"},{"name":"withAlias","comment":" Add an alias to a module to import\n","type":"String.String -> Install.Import.ImportData -> Install.Import.ImportData"},{"name":"withExposedValues","comment":" Add exposed values to a module to import\n","type":"List.List String.String -> Install.Import.ImportData -> Install.Import.ImportData"}],"binops":[]},{"name":"Install.Initializer","comment":" Add field = value pairs to the body of a function like `init` in which the\nthe return value is of the form `( SomeTypeAlias, Cmd msg )`. As in\nthe `ReviewConfig` item below, you specify the module name, the function\nname, as well as a list of item `{field = <fieldName>, value = <value>}`\nto be added to the function.\n\n    Install.Initializer.makeRule \"Main\"\n        \"init\"\n        [ { field = \"message\", value = \"\\\"hohoho!\\\"\" }, { field = \"counter\", value = \"0\" } ]\n\nThus we will have\n\n     init : ( Model, Cmd BackendMsg )\n     init =\n         ( { counter = 0\n           , message = \"hohoho!\"\n           , counter = 0\n           }\n         , Cmd.none\n         )\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.Initializer.Config"}],"values":[{"name":"config","comment":" Create a rule that adds fields to the body of a function like\n`init` in which the return value is of the form `( Model, Cmd msg )`.\nAs in the `ReviewConfig` item below, you specify\nthe module name, the function name, as well as the\nfield name and value to be added to the function:\n\n    Install.Initializer.makeRule \"Main\"\n        \"init\"\n        [ { field = \"message\", value = \"\\\"hohoho!\\\"\" }, { field = \"counter\", value = \"0\" } ]\n\n","type":"String.String -> String.String -> List.List { field : String.String, value : String.String } -> Install.Initializer.Config"}],"binops":[]},{"name":"Install.InitializerCmd","comment":" Consider a function whose return value is of the form `( _, Cmd.none )`.\nSuppose given a list of commands, e.g. `[foo, bar]`. The function\n`makeRule` described below replaces `Cmd.none` by `Cmd.batch [ foo, bar ]`.\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.InitializerCmd.Config"}],"values":[{"name":"config","comment":" Consider a function whose return value is of the form `( _, Cmd.none )`.\nSuppose given a list of commands, e.g. `[foo, bar]`. The function\n`makeRule` creates a rule that replaces `Cmd.none` by `Cmd.batch [ foo, bar ]`.\nFor example, the rule\n\n    Install.InitializerCmd.config \"A.B\" \"init\" [ \"foo\", \"bar\" ]\n        |> Install.initializerCmd\n\nresults in the following fix for function `A.B.init`:\n\n    Cmd.none -> (Cmd.batch [ foo, bar ])\n\n","type":"String.String -> String.String -> List.List String.String -> Install.InitializerCmd.Config"}],"binops":[]},{"name":"Install.Subscription","comment":" Use this rule to add to the list of subscriptions.\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.Subscription.Config"}],"values":[{"name":"config","comment":" Suppose that you have the following code in your `Backend.elm` file:\n\n    subscriptions =\n        Sub.batch [ foo, bar ]\n\nand that you want to add `baz` to the list. To do this, say\n\n    Install.Subscription.config \"Backend\" [ \"baz\" ]\n        |> Install.subscription\n\nThe result is\n\n    subscriptions =\n        Sub.batch [ foo, bar, baz ]\n\n","type":"String.String -> List.List String.String -> Install.Subscription.Config"}],"binops":[]},{"name":"Install.Type","comment":" `Install.Type` provides a rule that checks if a type is present\nin the given module and if not, it adds it right after the imports.\n\nFor example, the rule\n\n    Install.Type.config \"Frontend\" \"Magic\" [ \"Inactive\", \"Wizard String\", \"Spell String Int\" ]\n        |> Install.customType\n\nresults in insertion the text below in the module \"Frontend\":\n\n    type Magic\n        = Inactive\n        | Wizard String\n        | Spell String Int\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.Type.Config"}],"values":[{"name":"config","comment":" Rule to add a type to a module if it is not present\n","type":"String.String -> String.String -> List.List String.String -> Install.Type.Config"}],"binops":[]},{"name":"Install.TypeVariant","comment":" Add a variant to a given type in a given module. As in\nthe `ReviewConfig` item below, you specify the module name, the type\nname, and the type of the new variant.\n\n    Install.TypeVariant.config\n        \"Types\"\n        \"ToBackend\"\n        [ \"ResetCounter\" \"SetCounter Int\" ]\n        |> Install.typeVariant\n\nThen you will have\n\n     type ToBackend\n         = CounterIncremented\n         | CounterDecremented\n         | ResetCounter\n         | SetCounter Int\n\nwhere the last two variants are the ones added.\n\n@docs config, Config\n\n","unions":[],"aliases":[{"name":"Config","comment":" Configuration for rule.\n","args":[],"type":"Install.Internal.TypeVariant.Config"}],"values":[{"name":"config","comment":" Create a rule that adds variants to a type in a specified module:\n\n    Install.TypeVariant.config\n        \"Types\"\n        \"ToBackend\"\n        [ \"ResetCounter\", \"SetCounter: Int\" ]\n        |> Install.typeVariant\n\n","type":"String.String -> String.String -> List.List String.String -> Install.TypeVariant.Config"}],"binops":[]}]