F# 2014 – A Retrospective and Call to Action
reedcopsey.com
reedcopsey.com
If you believe the future of software engineering includes strongly typed functional languages, then F# is the place to be for many reasons:
1) Microsoft has settled into the role of corporate curator of the language, core libraries, and core tools. I personally know the small MS team supporting F#, and I can tell you they are motivated, enthusiastic, and very capable in this role. I can also tell you the major players in the other MS language and tooling teams take an interest in following the progress of F#. Not to mention the world's most advanced quantum computing simulation compiler is written in F#. http://research.microsoft.com/apps/pubs/default.aspx?id=2096...
2) F# is Microsoft's longest running major OSS effort, and the experience no doubt played a role in how MS roled out the recent open sourcing of .NET and commitment to making .NET cross-platform. Keep an eye on developments in this area, it will strengthen F# as a cross platform language.
3) And finally if you have an interest in hacking on functional languages, core components, libraries, tooling, etc., this is the place to be. You can make OSS contributions which will make a difference to users around the world.
BTW: Tomas Petricek's "Real-world functional progamming" as well as "Expert F#" by Don Syme are excellent introductions to the language.
Having said that, nearly all of the "core" projects are now being CI tested on mono as well as windows, and the fsharpbindings project provides autocompletion for Vim and Emacs (+ powers the MonoDevelop/Xamarin Studio F# support as well).
I'm having great fun writing F# code in Linux with Vim - now that .fsx (F# script) files have proper #! support you can just write fsx files with full highlighting, error checking and autocompletion in place and then run them with supervisord.
(Edit: although http://fsharp.org/use/linux/ covers the absolute basics pretty well)
Up until recently, packaging was a bit of an issue, but recently the official Mono repositories have started being much more up to date again, and now include recent versions of F# as well: http://www.mono-project.com/download/#download-lin
Getting vim support is still a case of cloning the project from github https://github.com/fsharp/fsharpbinding and running make in the vim directory - Vim 7.4+, make, python and a couple of other vim plugins required.
After that, things can start getting pretty nice. For (my only public) example, https://github.com/mavnn/Advent2014 shows how you can use fsx scripts and paket (a package manager compatible with nuget.org and taking source dependencies from github) to create a nice little project without needing to get into any of the Visual Studio project file nastiness. Of course, if you need to work on an existing project, the Vim bindings know about how to handle that too - but actually editing project files is still a pain.
One word of caution: there's currently a bug in the packaging for rpm: I'd go with Debian/Ubuntu packages at the moment. And as a final option, building from source is slow but has become pretty reliable over the last year or so.
The ecosystem is huge; http://nuget.org hosts the main .net package collection, and it fairly comprehension. Also, to be fair to MS the standard library is pretty "batteries included"; it just doesn't always have what I would consider the nicest APIs.
It does mean that you lose a number of traditional clr advantages such as JITting - and I have to admit that I haven't tried this route myself. Almost all of the clr code I've written has been server side.
I found both books kind of lacking, the former has examples in C# which I found distracting and the latter was too dry. If F# gets a book in the league of "joy of clojure" it would greatly help push F# into the mainstream.
Meanwhile, this is the best book if you like doing exercises as you learn( why wouldn't you? ). Not sure why the book is so underrated.
http://www.amazon.com/Functional-Programming-Using-Michael-H...
This guy does fsharp consulting but there is a WEALTH of good information in the series he has posted.
Other resources I found usefull for F# were Sestoft's "Programming language concepts" which uses F# to teach about interpreters and compilers and Flying frog consultancy's "F# Journal".
On the other hand, it's possible to "not get it" and write messy code in even the most bondage-oriented languages.
The language gives you plenty of tools to enforce the appropriate coding style for a given project.
1- In the more general case, you cannot enforce a rule to disallows clumsy/inelegant code. You cannot force proper use of the language.
2- In the Option/null case, this is an education problem. My boss is an old-school programmer with lots of experience (and I've seen him successfully solve and/or prevent real problems at work that bit every other team, so by no means I want to sound disrespectful of his experience), but he simply doesn't understand why Option is needed. He claims "defensive programming should be enough" (i.e. checking for null at every turn). He claims "academia is not good for anything", and I guess he sort of believes Scala is an academic language full of fancy but not really useful constructs. He is not completely sold on functional programming, pattern matching, etc. So I cannot simply have the language complain about nulls, because I must justify the enforcement of this rule to my boss, and he isn't convinced. (Note: this isn't limited to Option values; think of almost every feature/coding style from Scala that might sound unfamiliar to Java programmers, and it's the same problem with my boss).
[1] https://github.com/clojure/core.match [2] https://github.com/lazerwalker/clojurescript-koans/blob/mast...
I'm aiming that comment less at you than just generally because the general publicity around that is probably a bit lacking - but if things like that matter to you, F# is still a great place to look :)
Hope you carry on enjoying F# - the community is one of the friendliest, do come and say hello!
Things may have changed. I wasn't turned off by the fact that Linux support was so far from where it needed to be. I expected that. It was the toxic response that turned me off.
As for F#, I've been using it since beta. All I did was get the books and slog through them. Coming from a strong OOP background, I had quite a bit of "this makes my head hurt!" before the light started coming on, but once I came to grips with the power of the language, I didn't look back.
Yes, not all libraries are available on linux. I program F# almost exclusively on linux, and that doesn't bother me at all. The number of libraries that are available, compared to other platforms, is astounding. A couple of times I needed some kind of weird library, so I went and found an open source windows F# version (or C# version, gotta love CLR), then just added the project to my solution. Presto chango, I built both projects at the same time and got a huge amount of functionality for the price of an hour or so downloading code and building it.
(disclaimer: I write microservices any more. No GUIs)
Biggest problem I have with my set up is remembering some of the switches and tweaks to get the thing to build. My code runs so great without my having to horse around with it, so it might be months between getting out the tools. That's usually a couple of hours of banging my head against the wall, but once I've got the build cycle nailed, it's a sweet setup. Best I've used in a long time.
Most of the intro texts I tried were not good. I found a fantastic one, but it is an outdated, abandoned text that must be accessed through the Internet Archive [1]. I tried to contact the authors to see if I could help updating it, but received no response.
The language has a large surface area. It is not uncommon to think you have learned a lot of F#, then read a blog post by someone full of F# code and think "what the heck is that symbol?"
I agree with others that note the MS influence. Things are definitely getting better, but you will have an easier time if you are in the MS ecosystem.
For what it's worth, I wrote a blog post [2] that might be helpful if you're trying to get started.
[1]: http://web.archive.org/web/20110715231625/http://www.ctocorn... [2]: http://inchingforward.blogspot.com/2014/11/recommended-f-beg...
http://fsharp.org and Scott's site are the go to sites for all things F#. The Twitter hashtag #fsharp is sure to get you retweeted and/or responded to, and finally any well-formulated question to stackoverflow with an F# tag will get a speedy response.