jxxcarlson/elm-review-codeinstaller/11.0.1

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.config "Frontend"
    [ module_ "Foo.Bar" ]
    |> Install.Import.makeRule

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

Install.Import.config "Frontend" [ module_ "Foo.Bar" |> withAlias "FB" |> withExposedValues =  [ "a", "b", "c" ] ]
    |> Install.Import.makeRule

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

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

Initialize the configuration for the rule.

type alias ImportData =
{ moduleToImport : String
, alias : Maybe String
, exposedValues : Maybe (List String)
}

The functions config and module_ returns values of this type; The functions withAlias and withExposedValues transform values of this type.

module_ : String -> ImportData

Create a module to import with no alias or exposed values

withAlias : String -> ImportData -> ImportData

Add an alias to a module to import

withExposedValues : List String -> ImportData -> ImportData

Add exposed values to a module to import

qualified : 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.