Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which language is better for general purpose programming, F# or Haskell? [closed]

Tags:

.net

haskell

f#

I'm currently learning Haskell, Which language (F# or Haskell) do you prefer for programming general purpose applications?

Which do you think is the stronger language?

like image 998
Rayne Avatar asked Sep 27 '08 03:09

Rayne


2 Answers

I prefer Haskell.

Jon Harrop's claim that Haskell has poor tools caused me to think a bit, since I quite disagree with this. I think that the issue here is partly one of development style. Let's compare a few tool-related characteristics of F# and GHC:

  1. F# has extensive visual tools and GHC has none. For me, the lack of visual tools is irrelevant: I work with vi, a Unix command line, and a heavily custom build system. The lack of support for my style of development in F# would be very trying for me. On the other hand, if you prefer working under a Visual-Studio-type environment, you'd have quite the reverse opinion.

  2. F# and/or .NET I understand has a very good debugger. GHC has only a limited debugger that runs in the interpreter. I've not used a debugger in years (much of this due to using test-driven development) and when you work mostly with pure functions, as in Haskell, a debugger is much less necessary. So for me, the lack of this tool is fairly irrelevant.

  3. Libraries. This depends mostly on what libraries you need, doesn't it? Lots of good ones doesn't help if the one you need isn't there, and having lots of poorly-designed libraries may not be so helpful. Haskell certainly has fewer libraries than .NET, but it does have a reasonable selection, and the quality of the API design in many of them is very, very high.

I don't know what F#'s interface into native code libraries is like, but GHC is great for this, due to the fantastic FFI. I wrote a Windows DDE server entirely in Haskell (yes—not a line of C, not even to deal with callbacks from Windows C libraries) and it took considerably less time and was considerably simpler than doing the same thing in C or C++. If you need native code interfaces, Haskell is certainly the better choice.

The "unpredictability" of memory usage and performance is a good point. Haskell seems to me actually reasonably predictable if you know what you're doing, but you won't know what you're doing when you start out, and you'll have a lot to learn. F# is much more similar to other .NET languages.

Overall, this question probably comes down more to the platform than the language: the huge difference between the "Unixy world" of GHC generating native code and the "Windowsy world" of F# running on .NET is not a language issue.

like image 81
cjs Avatar answered Oct 20 '22 15:10

cjs


I'd go for Haskell. HackageDB is a great collection of libraries that are written specifically for the language. In the case of F# you'd have to use mostly libraries that are not written with a functional language in mind so they will not be as 'elegant' to use. But, of course it depends largely on how much functional programming you want to do and constraints of the project you want to use it for. Even 'general purpose' does not mean it should be used in all cases ;)

like image 35
eelco Avatar answered Oct 20 '22 15:10

eelco