Quickterface

Quick-to-program app interfaces in OCaml for terminal and web.

Overview

Quickterface is an OCaml library that lets you write interactive applications once and run them both as terminal UIs (TUIs) and web applications. Write your app logic using a simple IO interface, and Quickterface handles the rendering for both platforms.

Features

Installation

opam install quickterface

Quick Start

Create an app by defining a functor that takes an Io module:

module App : Quickterface.App.S =
functor (Io : Quickterface.Io.S) ->
struct
  let main ~io () =
    let%lwt () = Io.output_title io "My App" () in
    let%lwt () = Io.output_text io "What is your name?" () in
    let%lwt name = Io.input_text io () in
    let%lwt () = Io.output_text io ("Hello, " ^ name ^ "!") () in
    Lwt.return ()
end

Terminal App

module Terminal = Quickterface.Terminal_app.Make(App)

let () = Terminal.command ~argv:Sys.argv ()

Web App

module Web = Quickterface.Web_app.Make(App)

let () = Lwt_main.run (Web.run ())

Examples

See the test/examples/ directory for complete working examples including:

License

MIT

Author

Ofsouzap ofsouzap@gmail.com