A Gleam codegen library in Gleam
1# stare
2
3[](https://hex.pm/packages/stare)
4[](https://hexdocs.pm/stare/)
5
6```sh
7gleam add stare@1
8```
9```gleam
10import gleam/io
11import stare
12import stare/function
13import stare/value
14import stare/type_
15import stare/import_
16
17pub fn main() -> Nil {
18 let assert Ok(code) = stare.module(
19 imports: [
20 import_.import_(
21 module: ["gleam", "io"],
22 types: [],
23 constructors: [],
24 functions: [],
25 alias: None,
26 ),
27 ],
28 functions: [
29 function.function(
30 name: "main",
31 public: True,
32 parameters: [],
33 return_type: Some(type_.nil),
34 statements: [
35 function.call(
36 module: Some("io"),
37 function: "println",
38 arguments: [stare.value(value.string("Hello World!"))],
39 ),
40 ],
41 ),
42 ],
43 )
44 io.println(code)
45 // import gleam/io
46 //
47 // pub fn main() -> Nil {
48 // io.println("Hello World!")
49 //}
50}
51```
52
53Further documentation can be found at <https://hexdocs.pm/stare>.
54
55## Development
56
57```sh
58gleam run -m birdie # Run birdie
59gleam test # Run the tests
60```
61
62### Nix
63```sh
64nix run .#birdie # Run birdie
65nix run .#test # Run the tests
66```