4 ms·
What's the story for building a little HTTP server or command-line tool ? Go has a great batteries-included standard library.
by zimbatm 12y ago
What's the story for building a little HTTP server or command-line tool ? Go has a great batteries-included standard library.
- ufo 12y agoThe Ocaml standard library is pretty shitty (you certaily want to use one of the many stdlib replacements) but Opam is pretty neat for 3rd party libraries (albeit some areas are a bit fragmented for historical reasons).
- jallmann 12y ago> The Ocaml standard library is pretty shitty Oh come on, it's not that bad, it's just minimal. Usually I can get pretty far without having to reach for something like Batteries. That's a good thing, especially when writing reusable libraries where you don't necessarily want to pull in an entire stdlib replacement.
- tel 12y agoI'm really hoping as I've explored it more and more that the lightweight standard lib is a boon more than a weakness... but to achieve this there needs to be major force to drive useful functionality down into canonical library packages.
- amirmc 12y ago> "there needs to be major force to drive useful functionality down into canonical library packages" This tends to happen over time, as the community naturally converges on certain libraries, but it's rather opaque for a new user as to what those are. In some cases, you end up with two options and then life is a little more complicated (cf. async and lwt).
- mercurial 12y ago> building a little HTTP server opam install cohttp > command-line tool opam install cmdliner > Go has a great batteries-included standard library. OCaml doesn't, but there are good stdlib replacements, and its package manager is really nice.
- mjt0229 12y agoThanks for the pointer to `cmdliner`. I've built a handful of command line tools using Command from the Core library (as described by Real World OCaml [1]), but I always have to have the book open to use it. This looks very nice and it looks like it might fix an annoyance I have with Core's `Command`, which is that it won't parse flags without spaces (i.e., `-r2` failes to parse as equivalent to `-r 2`). [1] https://realworldocaml.org/v1/en/html/command-line-parsing.html https://realworldocaml.org/v1/en/html/command-line-parsing.h...
- ufo 12y agocmdliner's applicative-functor interface has a bit of a learning curve but the end result is some really clean programs. It can also generate manpages!
- amirmc 12y agoIf anyone would like to do things with Cmdliner, then there are few libs that would be great to have as stand-alone executables (it's part of the MirageOS Pioneer Projects) [1]. https://github.com/mirage/mirage-www/wiki/Pioneer-Projects#command-line-utilities https://github.com/mirage/mirage-www/wiki/Pioneer-Projects#c...
- zem 12y agonice list! was this always on the mirageos site? i remember spending some time poking around specifically looking for something like this, and coming up blank. (suggestion: link to it from the "contributing to mirage" page as well)
- AceJohnny2 12y ago