
So you're learning OCaml - e_d_g_a_r
http://hyegar.com/blog/2015/10/19/so-you%27re-learning-ocaml/
======
cheepin
If you are interested mainly in the functional language aspect of OCaml and
use Windows, F# is very close to OCaml in syntax/semantics, but has really
good support within Visual Studio (a really good debugger for example).

Once you want to use some of the more advanced features (Modules and Functors
come to mind), you can switch back to OCaml relatively easily since they are
so similar.

~~~
stevenmays
Any good books or resources for learning F#?

~~~
cflyingdutchman
[http://fsharpforfunandprofit.com/](http://fsharpforfunandprofit.com/)

~~~
sremani
I second that along, with fsharp.org and tryfsharp.org.

------
fermigier
Additional resources:

[https://github.com/rizo/awesome-ocaml](https://github.com/rizo/awesome-ocaml)

(via: [https://twitter.com/ocamlmooc](https://twitter.com/ocamlmooc) ).

------
plinkplonk
I love OCaml the language, but the tooling, especially wrt building
(ocamlbuild, Oasis etc) , is horrendous. That said, the situation is much
better now, than say 5 years ago.

~~~
e_d_g_a_r
Agreed.

FWIW I basically use the same _oasis file over and over again, it literally
takes only 5 minutes to set up a project's needed boilerplate, _oasis, .merlin
and opam directory.

~~~
laumars
Is there any good guides on how to do this? Or are your oasis template files
shared online?

~~~
e_d_g_a_r
I just amended the blog post with a cradle to grave example of creating
_oasis, .merlin and opam directory for any OCaml project.

~~~
plinkplonk
Very useful. Thank You! I basically gave up on OCaml for anything but toy
projects, but I may re consider that decision if this works for me.

------
cwyers
An OCaml MOOC just started yesterday, I think there's still time for people to
get in:

[https://www.france-universite-numerique-
mooc.fr/courses/pari...](https://www.france-universite-numerique-
mooc.fr/courses/parisdiderot/56002/session01/about)

Session 0 is just a lot of introductory stuff (history of OCaml, etc.), so it
shouldn't be difficult to catch up.

~~~
ufo
Is there a way to watch the classes and other course material without
registering?

~~~
FraaJad
The registration is free, unless you are weary of sharing your email with a
_university

_ (which are pretty good at guarding their students' privacy.. though you
should definitely check their policies before signing up)...

------
BoysenberryPi
I'm in this course I've been interested in the ML family of languages ever
since learning SML which is without a doubt my favorite language ever.

~~~
lemming
I really wish there were an implementation of SML that got some traction. It's
a lovely language, but has very few libraries for actually getting anything
done.

~~~
eatonphil
I do not think it is too late for SML necessarily. MLton (the full-program-
optimizing compiler) is very competitive with the (one) OCaml implementation.

As someone who did a lot to market certain OCaml libraries, I have seen
similar interest in some of the "modern" SML libraries I have played around
with. Not a ton of work has gone into both of these, but you may be interested
to look at two projects MonoML[0] and SSMLS[1].

These are some /very/ minimal projects I've worked on in SML in the past few
months to gauge how well SML might work as a modern, web-friendly, higher-
level language. The results are certainly not completely disappointing.

Edit: Oh also! HamletML[2] (yes, written by the 1ML guy) is a very interesting
ML implementation that would probably be a great way for work on modern
language features. Not that I know what I'm talking about, but it could also
provide the framework for an even more powerful backend/optimizing compiler.

[0] [https://github.com/eatonphil/monoml](https://github.com/eatonphil/monoml)

[1] [https://github.com/eatonphil/ssmls](https://github.com/eatonphil/ssmls)

[2] [https://www.mpi-sws.org/~rossberg/hamlet/](https://www.mpi-
sws.org/~rossberg/hamlet/)

~~~
seliopou
Unfortunately, SML has no industrial users. At least, that I've heard of. It's
a language that's used mostly in teaching and academic research. First ML I
used was SML/NJ in my intro CS class, and haven't seen it since. Whereas OCaml
has a many industrial users and is widely deployed. My favorite example is of
course management layer for the Xen hypervisor[0][1], but there are more as
well[2].

Adam Chlipala has a writeup[3] on comparing SML and OCaml that may be of
interest to the discussion.

[0]: [https://github.com/xapi-project](https://github.com/xapi-project)

[1]: [http://anil.recoil.org/papers/2010-icfp-
xen.pdf](http://anil.recoil.org/papers/2010-icfp-xen.pdf)

[2]:
[http://ocaml.org/learn/companies.html](http://ocaml.org/learn/companies.html)

[3]: [http://adam.chlipala.net/mlcomp/](http://adam.chlipala.net/mlcomp/)

~~~
BoysenberryPi
What do you think about Manticore? I'm curious.

------
cmrdporcupine
I like OCaml very much, though I haven't written code in it in the last 10
years, when I taught myself the language a long time ago I very much enjoyed
it. I preferred SML/NJ, but that never got any velocity.

It'd be nice to have a job working in OCaml.

------
teh64
Does anyone know any good GUI OCaml IDE for Mac (something like RStudio)?
Because the plugins for Eclipse and Intellij aren't very good and ocaml-top
doesn't seem to work.

~~~
ane
None exist. So far the best solution is to use Emacs with [2]

* merlin-mode, for autocompletion

* ocp-indent, for external code formating... think running gofmt on every enter press (surprisingly, it's fast enough unless your file is 2k lines long)

* tuareg-mode (everything else, REPL etc.)

* flycheck-ocaml for syntax checking

The "real" IDE plugins aren't even close and that's saying a lot since the
hodge-podge of addons I just listed isn't

The default Emacs user experience is awful so if you're a Vim user, just
install the "evil" package and enable it inside Emacs by doing M-x evil-mode,
then you have Vim inside Emacs. Or use Vim, but the experience isn't as
complete w.r.t. tooling[3]. There's always Spacemacs as well[1].

[1]
[https://github.com/syl20bnr/spacemacs](https://github.com/syl20bnr/spacemacs)

[2] [https://github.com/the-lambda-church/merlin/wiki/emacs-
from-...](https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch)

[3] [https://github.com/the-lambda-church/merlin/wiki/vim-from-
sc...](https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch)

~~~
teh64
Thanks for the links! I am currently using Sublime Text with the merlin
plugin, which is pretty good. But I guess I should learn emacs to use OCaml.

~~~
Drup
Stick with Sublime Text. As long as you have merlin, the rest doesn't matter.

~~~
e_d_g_a_r
Second Drup here, merlin is the key feature. (I didn't know sublime had a
merlin plugin)

~~~
teh64
Yeah it's this one: [https://github.com/cynddl/sublime-text-
merlin](https://github.com/cynddl/sublime-text-merlin) (The one on Sublime
Package Control is the same, but seems to be out of date and doesn't work).

------
gaius
Swift has lots of ML heritage, tho' not as much as F# obv

------
agumonkey
While digging for history I read these slides from David Turner (miranda and
other, pre-haskell)

[http://www-fp.cs.st-andrews.ac.uk/tifp/TFP2012/TFP_2012/Turn...](http://www-
fp.cs.st-andrews.ac.uk/tifp/TFP2012/TFP_2012/Turner.pdf)

It's not directly related to OCaml, but it retrace the roots of the ML family
too, so I thought it could be of interest.

------
iopq
Yes, I'm learning an OCaml dialect. It's called Rust, it's really interesting,
you should take a look at it.

~~~
placeybordeaux
Is there a good reason to say that Rust is an OCaml dialect?

~~~
jk4930
I'd describe it more as uglyfied Haskell, but anyway:
[http://science.raphael.poss.name/rust-for-functional-
program...](http://science.raphael.poss.name/rust-for-functional-
programmers.html)

~~~
bsummer4
It really doesn't have that much in common with Haskell either. It's designed
by people who are not oblivious about PL stuff, but it's still pretty
thoroughly in the C/C++ world in terms of both syntax and semantics.

It's not a _bad_ thing, but Rust has very little in common with Haskell/Ocaml;
aside from stealing a couple of good ideas.

~~~
FreeFull
I would say Rust's type system has a lot more in common with Haskell/Ocaml
than with C++, at least, although it's not quite as flexible as what Haskell
offers (a lack of HKT is painful sometimes).

~~~
bsummer4
I think the similarities are mostly superficial. I mean it has (local) type
inference, ADTs, and traits (which are sooooorta like type classes). But, as a
Haskell programmer, the Rust type system feels very foreign.

No typeclasses (and associated goodness), GADTs, HKTs, Monadic IO, first class
functions, generic deriving, higher rank types, existential type, etc. These
are bread-and-butter features in day-to-day Haskell work. Rust's type system
isn't powerful enough to build the vast majority of the tools that Haskell
programmers use every day.

I don't mean this as a criticism; The Rust design seems solid. But different
priorities lead to different trade-offs, and the end result is a very
different type system.

~~~
dbaupp
Traits do a lot of what one can do with typeclasses (they're mostly just
different names for the same thing), what differences are you thinking of?

Also, traits objects are existential types, and closures & functions are as
first class as they are in Haskell (main difference is a bit more verbosity).

