Hacker News new | past | comments | ask | show | jobs | submit login

What does F# do that other languages don’t? What it’s unique benefit?



It's just really pragmatic about the upsides of functional programming. It describes itself as "functional-first", but isn't afraid to fall back on OOP in situations where OOP really does model the situation better.

In my mind, it's taken the easiest 80% of the features of a true functional language, but then picked a pragmatic point at which to stop; the result is a language which is easy to learn and also makes it easy to use "most" of the good things you want from a functional language.


Type providers are novel.

It is a mechanism to provide type safe access to structured data and data services with almost no code. It feels like magic.

Like other ML-derived languages (F# is an OCaml dialect) it has algebraic data types and pattern matching to make code simple and complete without missing edge cases.

Also, it is arguably the best functional language on .NET, so it has a great platform with a large ecosystem to build on. And the tooling is great (Jetbrains, Microsoft IDEs).


I haven't done as much as I would like with them, but I feel like until someone tries type providers they don't get just how powerful they are. Being able to point to an example .csv file and have it generate the classes for you, and update them if you change said format, in a way that it ensures the types still work, is amazing. And you can do it for ANYTHING as long as you have a way to extract the data to feed it to the compiler.

I still need to learn how to write a type provider just so I can.


> it is arguably the best functional language on .NET,

it is also the only real one. On .NET we have C#, C++ and vb.net then there are some other fringe langs like IronPython or IronRuby and I think there is a PHP one too.


I forgot Boo and Nemerle. They are quite niche languages though.


It's the combination of features which is killer. I don't know of another language that offers all of these:

- Expression orientated

- Lightweight syntax

- Emphasis on immutable data and pure functions

- do-notation (in F# these are called Computation Expressions)

- Type-safety without too many annotations (global type-inference)

- Mainstream ecosystem of libraries (in this case .NET)

- Compile to JavaScript


Units of measure is also very cool!


For me is that pratically every time, if compile, it works.

It's really easy to express a domain (with discriminated union and type) and the defaults (immutability, option, removal of boilerplate, high order function to manipulate data, structural comparison not reference) allow me to write correct code, who is readable without too much friction.

Support a repl as first class, so that works too if you like repl driven development

Community is also nice


I believe it's the functional language option on top of .NET. From what I understand, it's a pretty well designed one too.

I don't work in the .NET ecosystem, but I know if came up a lot when I was getting into Erlang/Elixir.


Functional, readable, easy to learn, as performant as C#, has the benefit of huge .NET ecosystem of libraries.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: