{"repo":"leostera/minttea","free":true,"listed":false,"github":"https://github.com/leostera/minttea","clone":"git clone https://github.com/leostera/minttea.git","description":"A fun little TUI framework for OCaml","language":"OCaml","stars":474,"topics":["cli","multicore","ocaml","terminal","the-elm-architecture","tui"],"license":"MIT","category":"cli-tools","readme_excerpt":"Mint Tea A fun, functional, and stateful way to build terminal apps in OCaml heavily inspired by [BubbleTea][bubbletea]. Mint Tea is built on Riot and uses The Elm Architecture. [bubbletea]: https://github.com/charmbracelet/bubbletea Tutorial Mint Tea is based on the functional paradigm of [The Elm Architecture][tea], which works great with OCaml. It's a delightful way to build applications. This tutorial assumes you have a working knowledge of OCaml. [tea]: https://guide.elm-lang.org/architecture/ Getting Started For this tutorial, we're making a shopping list. We'll start by defining our dune-project file: And a dune file for our executable: Then we need to pin the minttea package to the github source: Opam will do some work installing minttea from the github source. We can run dune build to validate the package has been installed correctly. Great, now we can create a new shop.ml file and start by opening up Minttea : Mint Tea programs are composed of a model that describes the application state, and three simple functions: init , a function that returns the initial commands for the application to run update a function that handles incoming events and updates the model accordingly view , a function that renders the UI based on the data in the model The Model We'll start by creating a type for our model. This type can be anything you want, just remember that it must hold your entire application state. Initialization Next up, we'll create our initial model function. If creati","default_branch":null,"files":null,"tree":[],"storefront":"/r/leostera","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/leostera/minttea/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}