I’m new to writing Ocaml code and have some design and code style issues.
The main problem is that I don’t think I’m very good at OCaml and I need some advice on how to design a big project like this and what mistakes I’ve made so far. The point is, if I can correct my design problems now, when the project is early on, there will be less to fix in the future.
Some of the questions are:
Working with Lwt is it ok for the API to return a value of type "a Lwt.t option? I make a module for each endpoint, is there a better way to structure those endpoints? I also need to know what kinds of mistakes I made now, like code style, correctness, and if there are parts of the code that don’t follow some rules? Using modules some of the endpoints have a lot of parameters, creating a module for every endpoint and fill all those parameters becomes harder for the user. Should I implement just the functions for the most used parameters?
I try to make the code more functional by using pure functions, higher order functions and reducing side effects as much as possible.
Any other advice is welcomed.
I tried to make the library as easy as possible to work with but as the project scales it becomes harder to work with.
5 posts - 3 participants