Quick-to-program app interfaces in OCaml for terminal and web.
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.
opam install quickterfaceCreate 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 ()
endmodule Terminal = Quickterface.Terminal_app.Make(App)
let () = Terminal.command ~argv:Sys.argv ()module Web = Quickterface.Web_app.Make(App)
let () = Lwt_main.run (Web.run ())See the test/examples/ directory for complete working examples including:
MIT
Ofsouzap ofsouzap@gmail.com