3 ms·
OCaml is a great language. I'm so glad I was forced to learn at in university. Apart from the language itself, the ecosystem surrounding it is very mature as we
by krat0sprakhar 10y ago
OCaml is a great language. I'm so glad I was forced to learn at in university. Apart from the language itself, the ecosystem surrounding it is very mature as well.
- OCamlbuild is the bee's knees. Configuring complex projects requires just one line in the Makefile
- OPAM works wonderfully. No configuration required. Everything just works.
- Merlin (https://github.com/the-lambda-church/merlin https://github.com/the-lambda-church/merlin) is incredible. If you use Vim / Emacs, you owe it to yourself to set it up and have better syntax highlighting, indentation and type information right within your editor.
- Approachable online guides to get started. RWO[1] is a fantastic resource and teaches you the good parts right from the start.
- Utop (https://github.com/diml/utop https://github.com/diml/utop) is a very modern, fully-featured REPL (almost as good as IPython)
----------
If you've been thinking of learning OCaml, here are a few useful resources -
- Real World OCaml [RWO] - https://realworldocaml.org/ https://realworldocaml.org/
- Using, Understanding, and Unraveling the OCaml Language - http://caml.inria.fr/pub/docs/u3-ocaml/index.html http://caml.inria.fr/pub/docs/u3-ocaml/index.html
- Developing applications with OCaml - http://caml.inria.fr/pub/docs/oreilly-book/html/index.html http://caml.inria.fr/pub/docs/oreilly-book/html/index.html
- System programming in OCaml - https://ocaml.github.io/ocamlunix/ocamlunix.html https://ocaml.github.io/ocamlunix/ocamlunix.html
Lastly, if you are out of ideas on what to build with OCaml, try out these courses for some challenging programming assignments
- Functional Programming (Princeton) : http://www.cs.princeton.edu/~dpw/courses/cos326-12/info.php http://www.cs.princeton.edu/~dpw/courses/cos326-12/info.php
- Programming Languages and Compilers (UIUC): https://courses.engr.illinois.edu/cs421/fa2014/ https://courses.engr.illinois.edu/cs421/fa2014/
- cm3 10y agoIf you use Core, after reading RWO, and don't like the large executables, rest assured that there is an effort by one of the flambda devs to improve dead code elimination as well, but that will also take a while before it's available. I wish it would happen soon, now that flambda has landed.
- jonathanyc 10y agoTo provide an alternate viewpoint, OPAM isn't that great of a package manager if you've come from other languages or have used a Linux distro's package manager. It's incredibly slow, partly because you're supposed to use an external constraint solver. When it crashes, it leaves lots of things in an inconsistent state. It's environment handling is really picky and gives warnings about not being set up properly even when it is, because it used to (maybe still does) expect itself to be the last thing in a lot of environment variables. It is something I try to avoid when possible. EDIT: Sorry, realized I replied to the wrong comment. Meant to reply to the grandparent.
- e_d_g_a_r 10y agoWhen it crashes it literally gives you the command to undo the damage. How many package managers do that?
- adrusi 10y agoBetter to not cause the damage in the first place, consolidate the parts of the transaction that were usefully completed into an isolated location, and provide a way to resolve the issue and resume the transaction. I think at least Pacman and Yum do this.
- jallmann 10y agoCalling failed builds "damage" is rather overstating it. If building a specific package fails, OPAM continues with as many other packages as it can. Arguably that's not even "transactional" in the atomic sense, but the behavior is pretty much what you said. Then it gives you the error, and gives you a command to roll back everything to the previous state -- something I cannot do with eg, apt, as far as I know. But that's a bit apples and oranges -- apt, yum, pacman, etc are all binary package managers, with a different set of tradeoffs.
- Drup 10y agoI'm really wondering to which package manager you are comparing, because except cargo, all the other language package managers are either worse, or just straight crap. Linux distro package managers are usually decent, but most of them are binary package managers and don't offer the same set of feature, so it's a bit different (and they are a fair bit older too).
- pathsjs 10y agoI really miss the possibility of configuring dependencies per project in a easy way. OPAM will allow this using OPAM switches, but it is complex and error-prone, while most any other package manager (sbt, leiningen, maven, nimble, cargo, npm...) will do this by default. For some reason, OPAM defaults to installing dependencies globally and does not provide an easy way to support different workflows
- blubb-fish 10y ago> Lastly, if you are out of ideas on what to build with OCaml, try out these courses for some challenging programming assignments Is tackling real world projects also an option? Or is serving a web site something that is going to make you so proud of having done it with OCaml that you'll submit it to HN? (This reply might seem saracastic but it is actually meant seriously - as in, does it make sense to actually use it in production?)
- groovy2shoes 10y agoShort answer: yes. Long answer: as with anything, it depends. Any programming language is well-suited for some programming tasks and awkward for others. Except Lisp.
- blubb-fish 10y ago> Any programming language is well-suited for some programming tasks and awkward for others. Well ... with 50 shades of gray in between. You can do pretty much anything with Python f.x. But can you write a web service in Haskell without having to hire a team of computer science PhDs? Not so sure ... but luckily you're nephew will happily realize it with PHP during holidays for a couple of bucks :E
- groovy2shoes 10y ago"Awkward" may have been an understatement…