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.Rule.rule
[ Install.Import.config "Frontend"
[ Install.Import.module_ "Foo.Bar" ]
|> Install.Rule.addImport
]To add the statement import Foo.Bar as FB exposing (a, b, c) to the Frontend module, do this:
Install.Import.config "Frontend"
[ Install.Import.module_ "Foo.Bar"
|> Install.Import.withAlias "FB"
|> Install.Import.withExposedValues [ "a", "b", "c" ]
]There is a shortcut for importing modules with no alias or exposed values
Install.Import.qualified "Frontend"
[ "Foo.Bar", "Baz.Qux" ]Configuration for the rule.
The functions config and module_ returns values of this type; The functions withAlias and withExposedValues transform values of this type.
Create a module to import with no alias or exposed values
Add an alias to a module to import
Add exposed values to a module to import
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.
Initialize the configuration for the rule.