Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>Should you learn F# or Haskell if you know OCaml?</p> </blockquote> <p>I believe the answer is certainly yes, ideally you should learn all three languages because each one has something to offer but F# is the only one with a significant future so, if you can only feasibly learn one language, learn F# by reading my <a href="http://www.ffconsultancy.com/products/fsharp_for_technical_computing/?so" rel="nofollow noreferrer">Visual F# 2010 for Technical Computing book</a> or subscribing to our <a href="http://www.ffconsultancy.com/products/fsharp_journal/?so" rel="nofollow noreferrer">The F#.NET Journal</a>.</p> <p><strong>Longevity</strong> </p> <p>Microsoft committed to supporting F# when they released it as part of Visual Studio 2010 in April. So F# is guaranteed a rosy future for at least a few years. With a powerful combination of practically-important features like a high performance native-code REPL, high-level constructs for parallelism built-in to .NET 4 and a production-quality IDE mode, F# is a <em>long</em> way ahead of any other functional programming language in terms of real world applicability now. Frankly, nobody is even working on anything that might be able to compete with F# in the near future. My own open source <a href="http://www.ffconsultancy.com/ocaml/hlvm/?so" rel="nofollow noreferrer">HLVM</a> project is an attempt to do so but it is far from ready.</p> <p>In contrast, both OCaml and Haskell are being developed in extremely unproductive directions. This has been killing OCaml for several years now and I expect Haskell to follow suit over the next few years. Most former professional OCaml and Haskell programmers already moved on to F# (e.g. Credit Suisse, Flying Frog Consultancy) and most of the rest will doubtless migrate to more practical alternatives such as Clojure and Scala in the near future.</p> <p>Specifically, OCaml's QPL license prevents anyone else from fixing its growing number of fundamental design flaws (16Mb string and array limits on 32-bit machines, no shared-memory parallelism, no value types, parametric polymorphism via type erasure, interpreted REPL, cumbersome FFI etc.) because they must distribute derivative works <em>only</em> in the form of patches to the original and the Debian package maintainers refuse to acknowledge an alternative upstream. The new features being added to the language, such as first-class modules in OCaml 3.12, are nowhere near as valuable as multicore capability would have been.</p> <p>Some projects were started in an attempt to save OCaml but they proved to be too little too late. The <a href="http://groups.google.com/group/fa.caml/msg/735752c0a7a0ba4c" rel="nofollow noreferrer">parallel GC</a> is practically useless and David Teller quit the <a href="http://batteries.forge.ocamlcore.org/" rel="nofollow noreferrer">batteries included</a> project (although it has been picked up and released in a cut-down form). Consequently, OCaml has gone from being <a href="http://ocamlnews.blogspot.com/2007/11/most-popular-functional-languages-on.html" rel="nofollow noreferrer">the most popular functional language in 2007</a> to severe decline today, with <a href="http://groups.google.co.uk/group/fa.caml/about?hl=en" rel="nofollow noreferrer">caml-list traffic down over 50% since 2007</a>.</p> <p>Haskell has fewer industrial users than OCaml and, although it does have multicore support, it is still being developed in a very unproductive direction. Haskell is developed almost entirely by two people at Microsoft Research in Cambridge (UK). Despite the fact that purely functional programming is bad for performance by design, they are continuing to try to develop solutions for parallel Haskell aimed at multicores when the massive amounts of unnecessary copying it incurs hits the memory wall and destroys any hope of scalable parallelism on a multicore.</p> <p>The only major user of Haskell in industry is <a href="http://www.galois.com/" rel="nofollow noreferrer">Galois</a> with around 30 full-time Haskell programmers. I doubt they will let Haskell die completely but that does not mean they will develop it into a more generally-useful language.</p> <p><strong>Practicality</strong></p> <p>I wrote the article you cited about hash tables. They are a good data structure. Other people have referred to purely functional alternatives like ternary trees and Patricia trees but these are usually ~10× slower than hash tables in practice. The reason is simply that cache misses dominate performance concerns today and trees incur an extra O(log n) pointer indirections.</p> <p>My personal preference is for optional laziness and optional purity because both are generally counter productive in the real world (e.g. laziness makes performance and memory consumption wildly unpredictable and purity severely degrades average-case performance and makes interoperability a nightmare). I am one of the only people earning a living entirely from functional programming through my own company. Suffice to say, if I thought Haskell were viable I would have diversified into it years ago but I keep choosing not to because I do not believe it is commercially viable.</p> <p>You said "I don't like being tied to a bulky .NET framework unless the benefits are large". The benefits are huge. You get a production-quality IDE, a production-quality JIT compiler that performs hugely-effective optimizations like type-specializing generics, production-quality libraries for everything from GUI programming (see <a href="http://fsharpnews.blogspot.com/2010/02/john-conways-game-of-life-in-32-lines.html" rel="nofollow noreferrer">Game of Life in 32 lines of F#</a>) to number crunching. But the real benefit of .NET, at least for me, is that you can sell the libraries that you write in F# and earn lots of money. Nobody has ever succeeded selling libraries to OCaml and Haskell programmers (and I am one of the few people to have tried) but F# libraries already sell in significant quantities. So the bulky .NET framework is well worth it if you want to earn a living by writing software.</p> <p><strong>Well designed</strong></p> <p>These languages are all well designed but for different purposes. OCaml is specifically designed for writing theorem provers and Haskell is specifically designed for researching Haskell. F# was designed to address all of the most serious practical problems with OCaml and Haskell such as poor interoperability, lack of concurrent garbage collection and lack of mature modern libraries like WPF in order to bring a productive modern language to a large audience.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload