一个用于构建动态终端应用程序的库,由 Jane Street 开发。
Bonsai_term: A library for building dynamic terminal apps by Jane Street

原始链接: https://github.com/janestreet/bonsai_term

## Bonsai_term: OCaml 终端 UI 库 Bonsai_term 是一个用于构建终端用户界面 (TUI) 的 OCaml 库,其编程模型与它的 Web 版本 bonsai_web 相似。 入门需要安装 OCaml 的包管理器 **opam**,然后使用它安装 **bonsai_term** 和 **oxcaml**(一个依赖项)。 平台特定的安装指南可在网上找到。 安装完成后,学习资源包括 `bonsai_term.mli` 源代码文件和 `bonsai_term_examples` 仓库中的示例。 `bonsai_web` 的文档也很有帮助,重点是效果、状态和增量等概念——虽然“vdom”方面可能不直接适用于终端 UI。 最后,网上有大量的 OCaml 学习资源。

黑客新闻 新的 | 过去的 | 评论 | 提问 | 展示 | 工作 | 提交 登录 bonsai_term:Jane Street 开发的用于构建动态终端应用程序的库 (github.com/janestreet) 5 分,由 azhenley 发表于 2 小时前 | 隐藏 | 过去的 | 收藏 | 1 条评论 ranger_danger 21 分钟前 [–] 一个 OCaml 库*回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Bonsai_term is a library that lets you write Terminal UIs (TUIs) using OCaml. It uses the same programming model as the bonsai_web library.

  1. If you are new to OCaml - or if you haven't already - install opam. It is OCaml's package manager and we'll be using it to install bonsai_term and its dependencies. The specific installation instructions depend on your platform. You can find platform-specific instructions here.
  2. bonsai_term uses OxCaml so the next thing you'll want to do is install oxcaml by following the instructions here.
  3. Run opam install bonsai_term. (This will install bonsai_term and its dependencies).

At this point you should now have bonsai_term "installed".

To learn how to use bonsai_term you can read its MLI src/bonsai_term.mli and / or look at some examples in the bonsai_term_examples repo.

To learn how to use bonsai, you can read the docs in bonsai_web. (most of those docs are aimed at the "web" version of bonsai, so the "vdom" bits may not apply, but the "effect" / "state-fulness" and ways of doing "incrementality" all should transfer from bonsai_web into bonsai_term).

To learn how to use ocaml here are some good resources:

If you followed the install instructions at the top of this page, you can skip the "Install" instructions on the above links.

联系我们 contact @ memedata.com