Skip to content

Instantly share code, notes, and snippets.

View giacomocavalieri's full-sized avatar
🌸

Giacomo Cavalieri giacomocavalieri

🌸
View GitHub Profile

Some ideas on test and assert

I'm just trying to put this down to clear my mind and get a better feeling of how it could work. There may be some new ideas or horrible takes, you've been warned!

What this could look like

test as a keyword can be used to define any top level function f : fn() -> Nil that can be auto discovered and run by gleam test.

@giacomocavalieri
giacomocavalieri / read_line.gleam
Last active June 26, 2024 09:05
Lines stream in Gleam
import gleam/dynamic.{type Dynamic}
import gleam/int
import gleam/io
const file = "./lines.txt"
pub fn main() {
let assert Ok(stream) = open(file)
let assert Ok(lines) = do_count_lines(stream, 0)
lines |> int.to_string |> io.println
import decode.{type Decoder}
import extra
import gleam/dynamic
import gleam/json
import gleam/list
import gleam/string
import lustre
import lustre/attribute.{type Attribute}
import lustre/effect.{type Effect}
import lustre/element.{type Element}