For anyone interested in trying out F# online, looks like Microsoft Research has such a tool: http://www.tryfsharp.org/Create. Unfortunately looks like you have to create an account of some sort to share scripts, so these alternatives might be better:
Click on the Intro to F#. Or try the user contributed notebook:
https://notebooks.azure.com/library/HorsesForCourses
[msft]
One of the things Go does right is the download-hello-world-compile-run experience. Especially now, since they now default GOPATH. One of the things that Go does wrong for popularity is the opinionated directory structure based environment mechanism. It has some advantages for large programming projects, but the way it runs counter to many programmer's expectations is seen by many as a wat!?
If Go had some way of mitigating that and the lack of generics, then the Hello World experience would be better for more people. (For admittedly shallow reasons, IMHO. I think that Go is pretty good the way it is. I haven't yet felt a need for generics yet in my MMO project.)
Does the lack of generics really impact the experience of "Hello World"? I don't think I've ever seen generics used in a "Hello World" example even in languages that have them.
My issue with the online editors is that it restricts your ability to access files, add dependencies and modify your local machine. If anyone would like an online version I'd be interested to hear why?
The article is actually more of an annotated version of the F# Tutorial Script[0] which ships inside Visual Studio 2017 (also in other version of Visual Studio, but the Tutorial script is a bit different there).
You can get started with F# just about everywhere everywhere:
* Visual Studio[1]
* Visual Studio for Mac[2]
* Visual Studio Code (via Ionide plugins)[3]
* .NET Core and the .NET CLI (`dotnet new console -lang F#`)[4]
* Azure Notebooks (Jupyter in the browser via Azure) [5]
[0]: https://github.com/Microsoft/visualfsharp/blob/master/vsinte...
[1]: https://www.visualstudio.com/vs/visual-studio-2017-rc/
[2]: https://www.visualstudio.com/vs/visual-studio-mac/
[3]: https://marketplace.visualstudio.com/items?itemName=Ionide.I...
[4]: https://dot.net/core
If you have a short attention span, I recently started posting sped up screencasts on twitter that range between 1-2 minutes. https://twitter.com/FSharpCasts
If there's a feature you want to see, let me know. I take requests.
https://fsharpforfunandprofit.com/posts/is-your-language-unr...
I might be slightly biased but in my opinion it's one of the best programming articles I have ever read.
Discriminated Unions and pattern mactching still come in handy, the syntax is still less verbose, there is less biolerplate/ceremony than in C# where everything has to be in a class.
it is easier to pass a function to a function than in C#
inlining functions is easier
the type inference can be useful in various ways.
if/then/else statements being expressions is extremely nice.
I tend to code in a mostly imperative style, even in F#. I understand it better, it usually performs better.
Come to the Elixir/Erlang camp; our functional turtles go all the way down! The only jarring thing is having to write to a mutable database. They even borrowed the |> operator! And it has great pattern matching of course.
One of the biggest disappointments in software development to me though is that practically all of the cool libraries these days are hitting the javascript ecosystem rather than those of all the interesting languages.
So if you want to interact with these great libraries, you have to tolerate a pretty shitty language with annoying tooling at best. So when I want to do something practical, I wind up going that way disappointingly often.
Sometimes the answer is just so obvious to people who have that foundation knowledge that no one else has bothered to ask on reddit/stackoverflow and you are googling into the wind. Sometimes the only thing you can find is several years old and giving advice that's no longer correct. I'm not sure which is worse.
I had the same trouble trying to build a learning project in Clojure. I remember when starting, I had only used pip and apt-get (and not knowing them well), I didn't even recognize Leiningen as a package manager. It worked so differently from what I thought I needed (and billed itself as a "project automation and configuration tool") that I didn't even recognize it was the solution to my problem.
It's just so easy to take for granted how many things are obvious to us that make solving problems in our comfort zone easy for us and paralyzing for another person, and I think this bias finds its way into the documentation and mindset of entire communities. This makes it harder and harder for something to be approachable if you don't fit in that same box. I'd love to love F#, (I read F# for fun and profit and worked through the F# Koans, but haven't made anything), but I'm not sure if I'll ever get over the hump unless I find myself working somewhere that's already using it. My feelings on Python are somewhere between ambivalent and bitter by now, but the work gets done, I know what to expect, and I never feel lost.
What would really help me, I think:
- More "idiomatic" wrapper libraries around .NET libraries, even if they're slower or have less features/customization.
- Pure F# libraries of typical utilities or ports of popular libraries in other languages, even if they are slower or have less features/customization.
- Content about F# project management from the perspective of someone who uses Python. This is how you do it in Python, this is how you do it in F#, this is why, these are the pros, these are the cons, these are just different because that's the way it is.
You can do so along the way without focusing so much on doing idiomatic FP and achieve both pragmatic and palatable results.
Designing solutions with the type system enabled by F# and it's ability to interop with whole .NET ecosystem is really a powerful combination.
I doubt I would have ever stuck with Clojure longer than a day, for example, if it wasn't for this library. It's not very long and all the functions are very short, but it meant that everything I needed from the file system was a 30s peek at the documentation and exactly what I expected rather than ~30+ minutes futzing with Java and forgetting what I was doing in the process https://github.com/Raynes/fs
Anyway, now I have come to learn it is just another way of doing things but my C# programming style is heavily influenced by a more functional style. I never realised till I actually landed a job where I had to interact with more standard OOP principles.
I wish there was a way I could do more F# at my work.
I use it instead of Powershell for my own scripts.
I did a small video game in F# using unit annotation and was shocked at the number of bugs that unit annotation picks up at compile time.
If you work with a lot of unit conversions (pixels, inches, whatever), I highly recommend giving F# a shot on a small project.
Unit annotation + access to the .NET ecosystem has made this language a personal favorite for any project heavy with numbers.
the developer experience isn't great, it's complicated to install and to get started with and the ecosystem related to web development is quite poor. That's not the case for F# and I really really hope it picks up steam. ML languages are really great when it comes to data modelling, domain driven design, writing algorithms and stuff like that. they are a nice compromise between pure FP and OOP.
There are some nice tools as well: merlin, utop, and friends.
As to the ecosystem, I beg to differ: the ocsigen suite of tools (lwt, server, js_of_ocaml), Core, Bucklescript, etc. They're all amazing, well documented, and open source.
I think both languages are quite nice honestly. F# has become a lot more attractive now that .NET is more readily available on more platforms. I hope it gains more steam too!
Things like:
* how do I read a text file
* how do I write a text file
* how do I download a file using HTTP
* ...
- http://rosettacode.org/wiki/File_input/output#F.23
- http://rosettacode.org/wiki/HTTP#F.23
However, it's probably not terribly interesting since those are things that exercise the BCL, so any C# example would do to show you how it's done.
People are doing themselves a disservice if they scramble for a collection of cheat sheets since there are so good books available.
There's no better way to invite help from strangers. :)
VSCode plugin: https://marketplace.visualstudio.com/items?itemName=Ionide.I...
VS for mac: https://www.visualstudio.com/vs/visual-studio-mac/
There is a guide for VSCode + Ionide here: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tuto...
https://www.visualstudio.com/vs/visual-studio-mac/ for mac is pretty good. It's less than visual studio for windows, but still ok. Easy to get started.
Visual Code, this seems a highly preferred option, and a lot of Fsharpers seem to use it, even on windows. The learning curve is a bit higher as it's not an out of the box experience. The trend is to combine it with FAKE, Packet and .NET Core (which I'm finding hard to keep track of).
I'm using VS for windows for F# product development at the moment.
On my Mac I use both visual studio for Mac for just mucking about, and visual code to play around with the toolsets the trendy kids keep advocating.
The "elid" intrigued me and I tried to look it up but couldn't find anything. Is this just a typo?
PR out here: https://github.com/dotnet/docs/pull/1584
IIRC you just need to install mono, python, jupyter and ifsharp: https://github.com/fsprojects/IfSharp
All but last one should be on brew, for last one, you should be able to build it out of box with mono installed.
Don't hesitate to report issue on the repository if that fails.
I'd love to see some sort of bootstrapped version that makes use of .NET Native or CoreRT or whatever they use today, and I'd REALLY like to see a strong Stdlib for F# that takes into account what functional programmers are used to.
I've been doing functional programming for several years, and I feel like a moron working with F# because I don't know half of these dumb .NET classes and some of the domain problems don't really leave me able to budget enough time to bootstrap my own solutions OR learn all the .NET stuff I need. Especially not when I can jump into several other languages and have a working prototype often in days or hours.
I don't want to sound whiny either but it's such a punch in the gut when someone sees me struggling with basic FP stuff in F#, just because I guess I'm so proud of what I've learned about FP in other languages.
There's also some stuff that F# is missing, but it hasn't screwed me yet because I still haven't figured out enough about all the NET classes.
Then, effort on making functionally orientated base libraries (without relying on baking those things in FSharp.Core, but as set of small libraries) wrapping undelrying .NET APIs, taking inspiration from what is there in Haskell and other similar languages.
Most F# users today are fine relying on mostly .NET libraries + fresher F# libraries, but most projects will be done with a mix of paradigms (which is manageable in F#) which is not most appealing to people with significant FP background.
This is sort of a Microsoft M.O.