<p>I've searched on the Internet for comparisons between <a href="http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29" rel="noreferrer">F#</a> and <a href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29" rel="noreferrer">Haskell</a> but haven't found anything really definitive. What are the primary differences and why would I want to choose one over the other?</p>

[{'answer_id': 44969, 'author': 'Erik van Brakel', 'author_id': 909, 'author_profile': 'https://Stackoverflow.com/users/909', 'pm_score': 2, 'selected': False, 'text': "<p>Well, for one I'd say a main advantage is that F# compiles against the .NET platform which makes it easy to deploy on windows. I've seen examples which explained using F# combined with ASP.NET to build web applications ;-)</p>\n\n<p>On the other hand, Haskell has been around for waaaaay longer, so I think the group of people who are real experts on that language is a lot bigger. </p>\n\n<p>For F# I've only seen one real implementation so far, which is the Singularity proof of concept OS. I've seen more real world implementations of Haskell.</p>\n"}, {'answer_id': 44995, 'author': 'Xian', 'author_id': 4642, 'author_profile': 'https://Stackoverflow.com/users/4642', 'pm_score': 8, 'selected': True, 'text': '<p>Haskell is a "pure" functional language, where as F# has aspects of both imperative/OO and functional languages. Haskell also has lazy evaluation, which is fairly rare amongst functional languages.</p>\n\n<p>What do these things mean? A pure functional language, means there are no side effects (or changes in shared state, when a function is called) which means that you are guaranteed that if you call f(x), nothing else happens besides returning a value from the function, such as console output, database output, changes to global or static variables.. and although Haskell can have non pure functions (through monads), it must be \'explicitly\' implied through declaration.</p>\n\n<p>Pure functional languages and \'No side effect\' programming has gained popularity recently as it lends itself well to multi core concurrency, as it is much harder to get wrong with no shared state, rather than myriad locks &amp; semaphores.</p>\n\n<p>Lazy evaluation is where a function is NOT evaluated until it is absolutely necessary required. meaning that many operation can be avoided when not necessary. Think of this in a basic C# if clause such as this:</p>\n\n<pre><code>if(IsSomethingTrue() &amp;&amp; AnotherThingTrue())\n{\n    do something;\n}\n</code></pre>\n\n<p>If <code>IsSomethingTrue()</code> is false then <code>AnotherThingTrue()</code> method is never evaluated.</p>\n\n<p>While Haskell is an amazing language, the major benefit of F# (for the time being), is that it sits on top of the CLR. This lends it self to polyglot programming. One day, you may write your web UI in ASP.net MVC, your business logic in C#, your core algorithms in F# and your unit tests in Ironruby....  All amongst the the .Net framework.</p>\n\n<p>Listen to the Software Engineering radio with Simon Peyton Jones for more info on Haskell: <a href="http://www.se-radio.net/2008/08/episode-108-simon-peyton-jones-on-functional-programming-and-haskell/" rel="noreferrer">Episode 108: Simon Peyton Jones on Functional Programming and Haskell</a></p>\n'}, {'answer_id': 45031, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 5, 'selected': False, 'text': '<p>F# is part of the ML family of languages and is very close to OCaml. You may want to read this discussion on the <a href="http://www.oreillynet.com/mac/blog/2006/03/haskell_vs_ocamlwhich_do_you_p.html" rel="noreferrer">differences between Haskell and OCaml</a>.</p>\n'}, {'answer_id': 63988, 'author': 'Nathan Shively-Sanders', 'author_id': 7851, 'author_profile': 'https://Stackoverflow.com/users/7851', 'pm_score': 6, 'selected': False, 'text': '<p>Big differences:</p>\n\n<ul>\n<li>Platform</li>\n<li>Object orientation</li>\n<li>Laziness</li>\n</ul>\n\n<p>The similarities are more important than the differences. Basically, you should use F# if you are on .NET already, Haskell otherwise. Also, OO and laziness mean that F# is closer to what you (probably) already know, so it is probably easier to learn.</p>\n\n<p>Platform : Haskell has its own runtime, F# uses .NET. I don\'t know what the performance difference is, although I suspect the average code is about the same before optimisation. F# has the advantage if you need the .NET libraries.</p>\n\n<p>Object orientation : F# has OO, and is very careful to make sure that .NET classes are easy to use even if your code isn\'t OO. Haskell has type classes which let you do something like OO, in a weird sort of way. They are like Ruby mixins crossed with Common Lisp generic functions. They\'re a little like Java/C# interfaces.</p>\n\n<p>Laziness : Haskell is lazy, F# is not. Laziness enables some nice tricks and makes some things that look slow actually execute fast. But I find it a lot harder to guess how fast my code will run. Both languages let you use the other model, you just have to be explicit about it in your code.</p>\n\n<p>Minor differences:</p>\n\n<ul>\n<li>Syntax : Haskell has slightly nicer syntax in my opinion. It\'s a little more terse and regular, and I like declaring  types on a separate line. YMMV.</li>\n<li>Tools : F# has excellent Visual Studio integration, if you like that sort of thing. Haskell also has an <a href="http://www.haskell.org/visualhaskell/" rel="noreferrer">older Visual Studio plugin</a>, but I don\'t think it ever got out of beta. Haskell has a simple emacs mode, and you can <a href="http://cs.hubfs.net/forums/thread/298.aspx" rel="noreferrer">probably use OCaml\'s tuareg-mode</a> to edit F#. </li>\n<li>Side effects : Both languages make it pretty obvious when <em>you</em> are mutating variables. But Haskell\'s compiler also forces you to mark side effects whenever you use them. The practical difference is that you have to be a lot more aware of when you use libraries with side effects as well.</li>\n</ul>\n'}, {'answer_id': 871635, 'author': 'cjs', 'author_id': 107294, 'author_profile': 'https://Stackoverflow.com/users/107294', 'pm_score': 5, 'selected': False, 'text': "<p>A major difference, which is probably a result ofthe purity but I less see mentioned, is the pervasive use of monads. As is frequently pointed out, monads can be built in most any language, but life changes greatly when they are used pervasively throughout the libraries, and you use them yourself.</p>\n\n<p>Monads provide something seen in a much more limited way in other languages: abstraction of flow control. They're incredibly useful and elegant ways of doing all sorts of things, and a year of Haskell has entirely changed the way I program, in the same way that moving from imperative to OO programming many years ago changed it, or, much later, using higher-order functions did.</p>\n\n<p>Unfortunately, there's no way in a space like this to provide enough understanding to let you see what the difference is. In fact, no amount of writing will do it; you simply have to spend enough time learning and writing code to gain a real understanding.</p>\n\n<p>As well, F# sometimes may become slightly less functional or more awkward (from the functional programming point of view) when you interface with the .NET platform/libraries, as the libraries were obviously designed from an OO point of view.</p>\n\n<p>So you might consider your decision this way: are you looking to try out one of these languages in order to get a quick, relatively small increment of improvement, or are you willing to put in more time and get less immediate benefit for something bigger in the long term. (Or, at least, if you don't get something bigger, the easy ability to switch to the other quickly?) If the former, F# is your choice, if the latter, Haskell.</p>\n\n<p>A couple of other unrelated points:</p>\n\n<p>Haskell has slightly nicer syntax, which is no suprise, since the designers of Haskell knew ML quite well. However, F#'s 'light' syntax goes a long way toward improving ML syntax, so there's not a huge gap there.</p>\n\n<p>In terms of platforms, F# is of course .NET; how well that will work on Mono I don't know. GHC compiles to machine code with its own runtime, working well under both Windows and Unix, which compares to .NET in the same way, that, say, C++ does. This can be an advantage in some circumstances, especially in terms of speed and lower-level machine access. (I had no problem writing a DDE server in Haskell/GHC, for example; I don't think you could do that in any .NET language, and regardless, MS certainly doesn't want you doing that.)</p>\n"}]
['https://Stackoverflow.com/questions/44961', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3394/']