tysv

Package VersionHex Docs

gleam add tysv@1
import gleam/float
import gleam/int
import tysv

pub fn main() -> Nil {
  let data =
    "Vanilla, 23, 0.5
    Strawberry, 24, 0.75
    Mango, 34, 1.75"

  let assert Ok([
    #("Vanilla", 23, 0.5),
    #("Strawberry", 24, 0.75),
    #("Mango", 34, 1.75),
  ]) =
    tysv.row({
      use flavor <- tysv.parsed
      use price <- tysv.parsed
      use kg <- tysv.parsed
      #(flavor, price, kg)
    })
    |> tysv.col(Ok)
    |> tysv.col(int.parse)
    |> tysv.col(float.parse)
    |> tysv.build(data)
}

Further documentation can be found at https://hexdocs.pm/tysv.

Development

gleam run   # Run the project
gleam test  # Run the tests

Provenance

All code in this project is written naturally. No AI generation or assistance is used to implement any functionality.

LICENSE

tysv is made available under the terms of the EUPL-1.2 License.