This year’s International Conference on Functional Programming (ICFP) was in Berlin and a few of us Issuuees attended. One of the discussions we had with fellow caml herders was what people are wishing for in the future. It turns out everyone has different ideas on what to do. At Issuu we have a large variety of people from different backgrounds so I thought it might be interesting to document different perspectives.

For part one of this multi-part series I decided to interview Martin Slota, who is also our most recent coworker that has picked up OCaml so his experiences are pretty fresh.

Tell us a bit about your background, what do you use OCaml at Issuu for, how long have you been using it.

I guess my university background is heavy on theoretical stuff related to computer science, especially logic, various formalisms and stuff, but not really centered much around programming languages as such. About 6 years ago I escaped from all that to industry and so far have worked at 3 companies, one producing collaborative robots, a larger one that was all about delivering fast and secure Internet connectivity to everyone in the world and now Issuu. My tasks varied quite a bit, too, so I got my feet wet in variety of different technologies and projects.

Nowadays I use OCaml on the backend, typically plumbing out binaries that eat one sort of data, then process it a bit and finally push it somewhere else.

What are the most important features or tools that make your developer life easier on a daily basis?

I’d say merlin is really great. I’m not sure I’d be a smiling OCaml user without it. But who knows?

And then the expressivity of the type system is really good. I guess I use it at least partially as a tool to get my thoughts sorted out. It’s also great that the compiler is then strict and insists on enforcing the types throughout the code.

I guess another thing that helps a lot are the ppx code generators since they prevent lots of boring reading and typing. They’re also a very interesting compromise between Lisp macros and static types.

What things would make you more productive developing?

I guess I’d like to be faster at getting to the bottom of why the compiler is pissed at me. It happens to me pretty often that I mess something up and then spend a bit too much time figuring out what that was. Well, at least it feels like that. In most cases this is all my ignorance or failure to actually read the whole error message but sometimes the error message thrown my way just makes very little sense. Like, working with polymorphic variants can be super frustrating. Mixing these with module signatures and functors leads to daytime nightmares. But maybe that’s just me.

I think I might appreciate powerful refactoring tools. Not that I explored thoroughly what’s out there. But having sort of out-of-the-box tooling that’s similar in power to what you might get for Java would be great I think.

And then (and I haven’t thought this through) I would be interested in light-weight restrictions of built-in types, such as specific ranges of integers, specific kinds of strings, etc. You can certainly code these up yourself but maybe this can be made easier.

How did you learn programming OCaml? How difficult would you rank it compared to other languages? How big is the chasm between learning and running it in production?

I think the best written resource for me was the Real World OCaml book (development version). But I’d say I actually learned the most by just using the language and suffering from not knowing anything 😆

I think the difficulty is certainly on the high end. The compiler takes “ages” to install, there’s little quirks here and there that slow the setup down. While OPAM is really solid, it doesn’t deal with changing dependencies very well. Wiping your switch and making a new one is just too slow. All this adds up and I think you need a certain (non-trivial) amount of determination to persevere.

Learning and running it in production? Yeah, I don’t know. To me it feels like the code you eventually end up deploying (or even just testing end-to-end) tends to work better out-of-the-box than the equivalent in many other languages I worked with in the past. There’s this feeling of solidity and reliability. At the same time, the ecosystem really is rather lacking. Instead of focusing on the problem you’re trying to solve, you may end up spending most of the time on problems that in other ecosystems are solved already.

Which documentation resources do you use for learning and reference? How happy are you with them and what could be improved?

I guess most frequently I end up on Jane Street’s documentation. I think it really is a decent resource but finding exactly the thing you’re looking for can be a challenge. Necessity of clicks due to several layers of indirection and the occasional broken link don’t help.

I guess I also sometimes end up in the reference, mostly to understand how the standard library differs from core.

And then I sometimes go and read the Real World OCaml book where the exposition is more systematic and beginner-friendly.

I think some better search functionality, plainer descriptions and more examples would improve my experience a lot.

With your current knowledge, what would be your preferred environment to write an application with. Are there places where you see that OCaml has an edge?

I’m not really sure what my preferred environment really is. I think it depends really a lot on what the application is supposed to be doing.

I’d say that OCaml perhaps has an edge where most functional languages with a static type system have an edge, such as when maintainers change often (types help understand what’s up, pure functions tend to be easier to understand and replace), in the presence of concurrency (due to immutability by default) or when it’s critical to catch problems early on as a codebase undergoes extensive changes and refactorings. Perhaps it’s easier for me to flip the question around: I wouldn’t use OCaml if it was a bad match for the problem / platform or if, when compared to alternatives, it lacked essential tooling that’s expensive to replace.

Which existing or upcoming feature in the OCaml ecosystem are you or were you most excited about?

I heard that dune 2 (love the game, too!) will have caching for stuff. That’s exactly what I want! I’m just not sure whether what I imagine this will be is what it will actually be…

If you could magically change/fix one thing in OCaml, what would that be?

Only one thing? Well then let it be the pain of working with polymorphic variants. Poof! Gone! No more pain. 🙂