On Apr 12, 2017, at 1:18 PM, mars0i <
mars...@logical.net> wrote:
>
> I want to start learning F# from a good, up to date book.
F# 4.1 only came out about a month ago, so the most up-to-date books are still those that cover F# 4.0.
Don’t worry about that, though: the changes in 4.1 are primarily pure additions which you can learn incrementally after you finish the F# 4.0 book you decide on.
> I don't use Windows, I don't know C#, or .Net in any way.
I’m roughly the same, except that I use all the major platforms. The first serious .NET code I ever wrote was in F# 3.0. That app only runs on Windows because it drives a third-party Windows-only program, but the second serious app I wrote in F# 4.0 runs on Windows, macOS, and Linux.
So, I’ve been on both sides of the fence. I don’t find using F# on non-Windows platforms any more difficult than using other similar tools on that same platform.
> I'd rather not waste time trying to extract pieces of information I need from discussions of Visual Studio
I’ve only read a few F# books, so perhaps there are books that are basically F#-flavored Visual Studio tutorials, but that has not been my experience.
Within my limited experience, I think the book most suited to your desires is the one by the language’s creator, _Expert F# 4.0_ by Syme et al. It barely touches on Visual Studio. The bulk of the material is concerned with the language itself and its libraries, which are the same on all platforms.
That also seems to be the case for _Functional Programming Using F#_ by Hansen, based purely on its table of contents. (Haven’t read it.)
The F# language and libraries are big enough to fill several books. Any book that spent any serious amount of its space on any particular tool chain would have to shortchange the discussion of the language and libraries, so you wouldn’t want to read it anyway.
> I can't get any use out of info about graphical programming advice because it's all Windows-based.
Some GUI libraries for .NET are cross-platform (e.g. WinForms), and some aren’t (e.g. XAML).
Then you have Xamarin.Forms which is an attempt by Xamarin to express the UI once portably and have it translate to native look and feel.
> ...getting started with mono and .NET Core?
Apples and oranges.
Mono is a nearly-complete reimplementation of .NET. There are a few areas it doesn’t cover at all; I’ll point out XAML here again, for example. There are also areas with only partial support, such as
ASP.NET. See the Compatibility page for more info:
http://www.mono-project.com/docs/about-mono/compatibility/
.NET Core, however, is a purposely cut-down version of .NET that runs the same on all platforms it’s been ported to: Windows, macOS, Linux, and FreeBSD, at least. There are vast areas of .NET it doesn’t support, even on Windows. Neither of my major F# apps will port to .NET Core today; it’s not even a near thing.
I cannot recommend .NET Core for anything but certain classes of narrow uses at this time. One of those narrow use cases is learning the F# language, but if you choose this path, go into it realizing that even the non-comprehensive .NET library coverage in Syme’s book will run you into the .NET Core walls. If you’re focused more on the language than the library, this may not matter to you.
> (For whatever it's worth, I'm a big IDE fan
^ not?
> I'll use Xamarin
I suspect Xamarin Studio is on its way out, at least on Windows and macOS. It’s going to stay around at least until Visual Studio for Mac is stable, but I wouldn’t bet on how much longer after that.
They’ve already stopped accepting money for Xamarin Studio proper: they want you to buy Visual Studio Professional or Enterprise to get Xamarin Studio support now.
I wouldn’t be too surprised to see Xamarin Studio ceded back to the community as MonoDevelop, only.
> or whatever's necessary if it's just a Bad Idea to do without it.
F# is a language designed with strong editor support in mind.
The main area where this shows up is that Visual Studio does near-continuous background building of your project: every time you stop typing, the IDE silently rebuilds the changed modules; if it finds problems, it puts squiggly red underlines under the flagged bits of code, just like spell-checking in a modern word processor. If you hover your mouse cursor over the marked section of code, you get the compiler error in a popup.
This means you don’t have to formally build the software to get a list of errors and warnings. It also means that as you fix those problems, they disappear near-immediately without needing to do an explicit rebuild.
That feature is doubly helpful when learning a new language that is as strict as F#, because it visually chides you as soon as you start writing code that won’t compile. This builds good habits, as it encourages you to build up a solution one simple step at a time, rather than write a whole bunch of functions and then get a pile of errors all at once when you finally dare to start a build.
This does have a downside, which is that there is a point between when you start to express a thought and when you finish it where you know it won’t compile, but if you pause in your typing, it’ll start throwing red squiggly lines everywhere. This used to stress me out a bit, but now I just ignore it when I know I’m in the middle of expressing a thought. I only pay attention to the red squigglies when I think what I’ve typed is complete. If I still get red squigglies after completing the expression, I know I’ve got a real problem.
There is a popular Vim extension that has a similar effect, but it’s far more annoying for a couple of reasons:
1. It opens a new Vim window any time you have one of these errors, which as I’ve hinted above, happens frequently. Contrast Visual Studio, which takes up no additional screen real estate to show these errors.
2. It’s far less subtle than a pale red squiggly underline, making it more stressful.
The .NET Library is also rather difficult to use without an IDE. It’s easy to scoff at code completion and such when you’re dealing with a flat or nearly-flat library namespace (e.g. C, PHP, Perl…) but .NET is both wide *and* deep. You need code completion if only to avoid RSIs.
I recommend that you at use Visual Studio for Mac (!) at least long enough to get started, then you can consider switching back to Vim once you’ve ready to take off the training wheels.
https://www.visualstudio.com/vs/visual-studio-mac/
Alternately, you can try the VS Code + Ionide + amVim (or similar) combo. I have little experience with that, but some people like that better than either Vim or Visual Studio.
> I do most of my work in vim, with repl handy if possible.)
There are Vim-compatible extensions for Visual Studio for Windows, but Visual Studio for Mac only has a few extensions at this time. I hesitate to guess how long it will take for one or more of the Vim extensions for VSWin to get ported over.
Both versions of Visual Studio have F# REPL windows — called F# Interactive — with tight integration into the regular text editor. You can highlight a section of code and send it directly to the REPL, for example.
The version in Visual Studio for Mac seems somewhat broken at the moment, though:
/unknown(1,1): error FS1225: File '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/FSharpBinding/FSharp.Core.optdata' not found alongside FSharp.Core. File expected in /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/FSharpBinding/FSharp.Core.optdata.
/unknown(1,1): error FS0229: Error opening binary file '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/FSharpBinding/FSharp.Core.dll': Exception of type 'Microsoft.FSharp.Compiler.ErrorLogger+StopProcessingExn' was thrown.
/unknown(1,1): error FS3160: Problem reading assembly '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/FSharpBinding/FSharp.Core.dll': Exception of type 'Microsoft.FSharp.Compiler.ErrorLogger+StopProcessingExn' was thrown.