This is a “wiki post” and can be edited by any user - click on the green button to the top right
What can I use to write a GUI?
Is anyone doing work creating GUIs in OCaml right now? If so, what GUI library are you using?
lablgtk is out of date, supporting only Gtk+2.
lablqt is now called lablqml, and the tutorial is offline. Not sure what’s going on with this library, but it seems in transition.
So is there anything up-to-date, or are people just not making use of GUI libraries?
I’m sure this is a FAQ (shouldn’t there a FAQ btw?), but, which of the bindings for GUI libraries under active development/well maintained? I might want to build a couple of small tools for myself and I’d like to learn something that is likely to remain usable for a while.
(Alternatively, people could answer the question “if I had to write some software in OCaml featuring a GUI, currently I would use the following libraries, tools, or techniques…”)
What can I use to connect to a database?
I’ve been hovering around for the past few weeks looking for an adequate database binding library for use with OCaml. So far the most supported ones seems to be
PGOCaml, postgresql-ocaml, and ocaml-mysql. The latter two are bindings for the respective C APIs (libpq and libmysqlclient), which seems to be too low-level (and blocking)… and PGOCaml, while widely suggested, uses the deprecated camlp4 which doesn’t seem to play well with jbuilder (it could be done I think, just some extra work is invo…
How can I extend an existing module?
If I want to extend List with additional functions, I can just do:
include module type of List
val flat_map : ('a -> 'b list) -> 'a list -> 'b list
let flat_map f l = flatten (map f) l
and that’s fine. But if I want to extend Format, this simple trick doesn’t work so well, because the new module will have distinct types. So I need:
include module type of Format
with type formatter = Format.formatter
and type formatter_out_functions = Format.formatter_out_functions
OCaml Language Improvements
What’s the status of modular implicits?
Are we going to merge this to master? If not what’s blocking it? Thanks!
What’s the status of multicore (and algebraic effects)?
A topic for discussing
Multicore OCaml project. Multicore OCaml adds native support for concurrency (through effect handlers) and parallelism. The Multicore OCaml project wiki has information for installation, papers, articles, talks and examples.
If you are looking for the current status of multicore and the list of things to do, checkout the projects page.
A comprehensive collection of links to useful libraries is available in
The BuckleScript engine:
BuckleScript is an optimizing compiler which compiles OCaml to readable JS. It is open sourced by Bloomberg since 2016.
BuckleScript is also the official JS bakcend for Facebook ReasonML, it has first class support for both vanilla OCaml and Reason syntax. It is also used by companies like Facebook in https://messenger.com and Google in cross-compiling WebAssembly interpreter into JS.
BuckleScript compiles one OCaml module into one JS module without name mangling, users can try it in the play…
and the Ocsigen project which includes js_of_ocaml:
Ocsigen is a complete framework for Web and mobile developement in OCaml.
ocsigen for all Ocsigen-related discussions on this site.
Ocsigen consists of several mostly independant projects:
Eliom: the most advanced multi-tier framework, for developing multi-platform Web and mobile apps
Tyxml: a library for building statically correct HTML5 and SVG documents
Lwt: a cooperative threading library for client or server concurrent comput…
There are many libraries available for server-side web development as well:
This category is for discussing web development in OCaml, with some of the major pieces of this puzzle being:
opium is a Sinatra-like framework built on cohttp.
Eliom is a more full-featured framework for server or client-server Web and mobile app development, from the Ocsigen project. It turns OCaml (or Reason) into a multitier language, which simplifies a lot the communication between client and server. It makes it possible to write both the Web and mobile apps (Android, iOS …) wi…
Basis (or "Standard") Libraries
The basis library supplied by OCaml is designed for the compiler distribution. There are several community-maintained libraries that provide enhanced functionality.
Jane Street Core is a set of industrial-strength basis libraries that are designed to work well together.
core tag is for discussing the Base/Core/Async suite of libraries. All of these libraries are designed to work well together and share common idioms (though they can be used independently as well)
Here’s a quick guide to the major pieces:
Base: Newest of the group. A replacement for the Inria stdlib. It’s designed to be lightweight, portable, and easy to build. There are no UNIX dependencies or build-time dependencies on PPXs.
Stdio: a complement to Base, containing basic blocking IO,…
Lwt is a library for concurrent programming in OCaml. It is developed by the community, and is one of OCaml’s most-used libraries.
Lwt is based around the familiar concept of promises. When you make an I/O request with Lwt, the library gives you a promise. It then runs the request in the background, without blocking the rest of your program. When the request completes, Lwt fulfills the promise, running any handlers you’ve attached. Lwt can process huge numbers of such requests concurrently.
OK. I can update the original post in this thread to make it the FAQ. We don’t have to pin it right now, of course, but I want to get some consensus that I’m answering the right questions, in the right way.
As for collaborating maintainers, I don’t know the mechanics of how that works, but I’m guessing someone with admin privileges can edit posts? I’m happy to work with anyone to maintain a useful FAQ.
Wiki Posts. You can specify the minimum trust level of a user to be allowed to edit the wiki. It has several limitations though.
Maybe interesting to start from somehting:
FYI, I’ve added a few FAQs to the original post in this thread, and will keep an eye out for more. Suggestions welcome! I’m being a bit lazy and just pointing at the definitive threads for the topics rather than typing out the answers myself, though.
Now that I think about it, this linking method could be advantageous. It means I don’t have to maintain a central repository of answers: anyone who wants to maintain an answer can keep it in their own thread, and I can just link to it. In other words, it spreads the work out to many threads, one per question.
Generally having a FAQ maintained as a Wiki has similar properties.
I agree that this linking method is a perfect way to keep track of “interesting” threads, and also makes a pretty decent replacement for some posts that were formerly pinned to Categories. I’m just back from vacation and going through the Category rearrangement as soon as I catch up on email
I’ve experimentally turned this post into a wiki post, which means that anyone can add interesting topics to the original one at the top. Beware of concurrent edits though, as I believe last-one wins in the Discourse implementation.
@yawaramin I’ll promote this to a pinned topic and link it from the central FAQ that covers code of conduct and such. Are you ok with it remaining “owned” by you or should I transfer the posting name to discourse or similar. Thanks again for making this happen
Thanks! I am OK with being the ‘owner’, I keep an eye on the discussion topics via RSS so I’ll update it whenever I see a good FAQ candidate.