jxxcarlson/elm-review-codeinstaller/9.0.0

NOTE: the latest version is 13.0.0

Install.Import

Add import statements to a given module. For example, to add import Foo.Bar to the Frontend module, you can use the following configuration:

Install.Import.init "Frontend"
    [ { moduleToImport = "Foo.Bar", alias_ = Nothing, exposedValues = Nothing } ]
    |> Install.Import.makeRule

To add the statement import Foo.Bar as FB exposing (a, b, c) to the Frontend module, do this:

Install.Import.init "Frontend" [ { moduleToImport = "Foo.Bar", alias_ = Just "FB", exposedValues = Just [ "a", "b", "c" ] } ]
    |> Install.Import.makeRule

There is a short cut for importing modules with no alias or exposed values:

Install.Import.initSimple "Frontend" [ "Foo.Bar", "Baz.Qux" ]
    |> Install.Import.makeRule
String
-> List
{ moduleToImport : String
, alias_ : Maybe String
, exposedValues : Maybe (List String)
}
-> Config

Initialize the configuration for the rule.

initSimple : String -> List String -> Config

Initialize the configuration for the rule.

makeRule : Config -> Rule

Create a rule that adds a list of imports for given modules in a given module. See above for examples.