Hacker News new | past | comments | ask | show | jobs | submit login

I know these languages are both members of the ML language, but why would one pick OCaml over F#?

I've toyed a bit with both and F# seems a bit more ergonomic: pipes, computation expressions, a more concise syntax, etc. I do like how fast the OCaml compiler is though.




The most straightforward reason to pick OCaml over F# is that OCaml's not tethered to the .NET world. Though this is also an excellent reason to pick F# over OCaml!

OCaml's type and module system is generally more sophisticated than F#'s - F# doesn't have GADTs, all the functor-y goodness of OCaml's module system, or even OCaml's weird-but-brilliant structurally typed object system. The new algebraic effects that OCaml's getting imminently are pretty killer, too. F#, of course, has several awesome features that OCaml lacks.


OCaml has had pipes for a long time and it has also added let-operators, which are very similar to computation expressions. In the upcoming version 5 they are also going to push towards direct-style coding of parallelism and concurrency thanks to the new effects systems, making 'futures', 'promises' etc. and their use with computation expressions obsolete.


> but why would one pick OCaml over F#?

For me it would be because OCaml is supported by Ubuntu as a package. In contrast, for installing F# you need to add an external repository and mess with GPG keys etc. which seems odd. Perhaps I'm wrong but what it tells me is that F# is not yet fully embraced by the open source/Linux community.


I find this to not be the case. Essentially anything .netcore to .net5+ is Linux/osx/ windows.

Checkout the docs* to install in Ubuntu.

F# was open source before any major MSFT project was. In fact it just recently got officially folded into the .net project/repos.

https://docs.microsoft.com/en-us/dotnet/core/install/linux-u...


Ocaml has pipes now.

It also has modules that take other modules as arguments and produce new modules - these are called functors. They're a really useful way of organising code, with F# you'd use .NET objects for similar issues. Nothing against objects - I'm not one of those - but the ocaml design just feels a lot cleaner.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: