gleamgen/import_
Types
pub type ImportedModule {
ImportedModule(name: List(String), alias: Option(String))
}
Constructors
-
ImportedModule(name: List(String), alias: Option(String))
Functions
pub fn function0(
imported: ImportedModule,
func: fn() -> a,
) -> Expression(fn() -> a)
Import an existing function from the module. Useful for importing functions and automatically getting their types Note that the function does not check if the provided function actually exists in the module.
let dict_module = import_.new(["gleam", "dict"])
let dict_new = import_.function1(dict_module, dict.new)
// dict.new ^ is a reference to actual function from gleam/dict
// Therefore this type checks:
expression.call0(dict_new)
// but this does not:
expression.call1(dict_new, expression.int(46))
pub fn function1(
imported: ImportedModule,
func: fn(a) -> b,
) -> Expression(fn(a) -> b)
Import an existing function from the module. Useful for importing functions and automatically getting their types Note that the function does not check if the provided function actually exists in the module.
let io_module = import_.new(["gleam", "io"])
let io_println = import_.function1(io_module, io.println)
// io.println ^ is a reference to actual function from gleam/io
// Therefore this type checks:
expression.call1(io_println, expression.string("Hello, World!"))
// but this does not:
expression.call1(io_println, expression.int(46))
pub fn function2(
imported: ImportedModule,
func: fn(a, b) -> c,
) -> Expression(fn(a, b) -> c)
Import an existing function from the module.
See function1
for more details.
pub fn function3(
imported: ImportedModule,
func: fn(a, b, c) -> d,
) -> Expression(fn(a, b, c) -> d)
Import an existing function from the module.
See function1
for more details.
pub fn function4(
imported: ImportedModule,
func: fn(a, b, c, d) -> e,
) -> Expression(fn(a, b, c, d) -> e)
Import an existing function from the module.
See function1
for more details.
pub fn function5(
imported: ImportedModule,
func: fn(a, b, c, d, e) -> f,
) -> Expression(fn(a, b, c, d, e) -> f)
Import an existing function from the module.
See function1
for more details.
pub fn function6(
imported: ImportedModule,
func: fn(a, b, c, d, e, f) -> g,
) -> Expression(fn(a, b, c, d, e, f) -> g)
Import an existing function from the module.
See function1
for more details.
pub fn function7(
imported: ImportedModule,
func: fn(a, b, c, d, e, f, g) -> h,
) -> Expression(fn(a, b, c, d, e, f, g) -> h)
Import an existing function from the module.
See function1
for more details.
pub fn function8(
imported: ImportedModule,
func: fn(a, b, c, d, e, f, g, h) -> i,
) -> Expression(fn(a, b, c, d, e, f, g, h) -> i)
Import an existing function from the module.
See function1
for more details.
pub fn function9(
imported: ImportedModule,
func: fn(a, b, c, d, e, f, g, h, i) -> j,
) -> Expression(fn(a, b, c, d, e, f, g, h, i) -> j)
Import an existing function from the module.
See function1
for more details.
pub fn new_with_alias(
name: List(String),
alias: String,
) -> ImportedModule
pub fn unchecked_ident(
imported: ImportedModule,
name: String,
) -> Expression(a)
pub fn unchecked_type(
imported: ImportedModule,
name: String,
) -> CustomType(a, b)
pub fn value_of_type(
imported: ImportedModule,
name: String,
type_: GeneratedType(a),
) -> Expression(a)