←back to thread

Why F#?

(batsov.com)
447 points bozhidar | 2 comments | | HN request time: 0.43s | source
Show context
raphinou ◴[] No.43547463[source]
F# was for me the best functional language when I looked at rewriting a Ruby on Rails app. I wanted to go with a functional language, as it seems to better fit my thinking and reasoning, and I looked at Haskell, Ocaml, Scala, F#.

Being a stranger to Microsoft technologies, F# was the least likely to be chosen, but easily became the first choice. Haskell's purity made it hard to adopt (for me), Ocaml's ecosystem is subpar (there wasn't even a clear choice for a library to interact with postgresql, I couldn't install the latest version due to its reliance on an obscure tool whose name I forgot and didn't get help on the forum), and Scala is seems complex....

F# was surprisingly easy to get started with. The community is mis-managed by a corporate-minded approach (requiring people to become member of the F# software foundation to get access to the official slack!), but its members are friendly, smart and ready to help. The ecosystem is great with access to all the dotnet libraries (some complain there's a mismatch as most of those are developed for use with C#, but I rarely got in trouble for using them).

There are also great libs and frameworks available. Like https://github.com/SchlenkR/FsHttp to easily interact with http servers, to the point that I find it easier to use than a dedicated library. Or https://github.com/CaptnCodr/Fli , to run commands. And last but not least, https://www.websharper.com/ is the best web framework I have encountered across all ecosystems. Their reactive approach to web ui really allows me to develop complex interfaces in a maintainable way.

This became a longer message than I thought, probably due to my enthousiasm for the language. For complete transparency, the situation is not perfect, and in my experience the tooling is not the best.

If you want more info, I blogged about it a couple of months ago: https://www.asfaload.com/blog/consider-fsharp/

replies(5): >>43547792 #>>43547982 #>>43548045 #>>43548126 #>>43549735 #
breadwinner ◴[] No.43548126[source]
Apache Spark, Delta Lake are written Scala. Being JVM based, it has a large ecosystem. Scala seems like a better choice than F#.
replies(2): >>43548326 #>>43548391 #
innocentoldguy ◴[] No.43548391[source]
I think Clojure is the better option if you want to do FP using the JVM ecosystem. The problem (for me, anyway) I've run into with Scala is that it supports both functional programming and object-oriented programming. Every code base I've worked on in Scala has ended up being a hodgepodge of both, which I find annoying.

However, the best functional programming language is, of course, Elixir. :D

replies(4): >>43548470 #>>43549065 #>>43550751 #>>43552557 #
michaelcampbell ◴[] No.43550751[source]
Isn't Clojure similarly (or even moreso) multiparadigm?
replies(1): >>43552587 #
1. lucyjojo ◴[] No.43552587[source]
i don't think it is. i would say it is functional + bridges to the jvm (which is why it has been ported to many other platforms... there is not that much stuff in the language itself).

it is functional (value) programming first. there are tools to hook in the object jvm stuff but this is not the natural grain of the language.

clojure is pretty much all values and functions (and some macroes).

+ some concurrency stuff

there is no class, there is no inheritance, you don't even have information hiding (no private etc.). you have protocols and multimethods.

(well technically there is private because java but it is not obvious to use and not what you expect, you will very rarely see that in clojure codebases)

honestly it is a nice small yet powerful language, with not too many kludges. my personal coding is either clojure or rust (which has way more kludges, but better than the other stuff in the typed fast compiled world at least for me).

replies(1): >>43595964 #
2. michaelcampbell ◴[] No.43595964[source]
I mean to each their own, but a quick search of "clojure multiparadigm" comes up with a fair number of hits from people who would disagree with it not being so.