F# for Fun and Profit
fsharpforfunandprofit.com · Personal blog · on HN since 2013
Scott Wlaschin writes tutorials on F# and functional programming, including railway-oriented programming and domain modeling with types.
What HN saysCommenters recommend it as a great learning resource for functional programming ideas, even for people who never write F#.
334HN people shared it
268linked it in comments
110stories submitted
2.4Kstory points
3 months agolast shared
2013people per year2026
Most-shared posts
- 1F# for Fun and Profit74 people · 60 points · first shared 2013 · 6 comments on HN
- 2Railway-Oriented Programming (2015)53 people · 351 points · first shared 2015 · 160 comments on HN
- 3Railway-oriented programming30 people · 314 points · first shared 2013 · 57 comments on HN
- 4Designing with types: Making illegal states unrepresentable23 people · 3 points · first shared 2017 · discussion on HN
- 5Choosing properties for property-based testing (2014)18 people · 44 points · first shared 2014 · discussion on HN
- 6Ddd15 people · first shared 2014
- 7Statically Typed Units of Measurement in F#14 people · 7 points · first shared 2014 · discussion on HN
- 8Why Use F#?11 people · 226 points · first shared 2013 · 205 comments on HN
- 9Is your programming language unreasonable? (2015)11 people · 172 points · first shared 2015 · 130 comments on HN
- 10Property-Based Testing in F#11 people · 18 points · first shared 2015 · discussion on HN
- 11Functional Programming Design Patterns10 people · 6 points · first shared 2015 · discussion on HN
- 12Against Railway-Oriented Programming9 people · 14 points · first shared 2019 · discussion on HN
- 13Designing with Types in F#9 people · 1 points · first shared 2013 · discussion on HN
- 14Leveraging the F# type system to correctly implement a shopping cart8 people · 5 points · first shared 2013 · discussion on HN
- 15Designing with Types (2013)7 people · 2 points · first shared 2021 · discussion on HN
What HN people wrote when they linked it
kingkongjaffa · 2025-04-01
F# is great
Even if you never write a single line, it’s a fantastic illustrative language.
For example I refer to https://fsharpforfunandprofit.com/ all the time for functional programming ideas.
agentultra · 2025-01-16
Is TST essentially the validation monad[0]?
Glad to see more folks finding and appreciating FP languages like F#. It's good stuff. Scott Wlachin has a great site to discover more F# goodness[1].
[0]: https://hackage.haskell.org/package/monad-validate-1.3.0.0/docs/Contro…
[1]: https://fsharpforfunandprofit.com/
725686 · 2024-11-10
I have never done F#, but when I was looking around it this seemed like a greate resource: https://fsharpforfunandprofit.com/
progmetaldev · 2024-08-07
While a bit dated, F# For Fun and Profit is a great learning resource:
https://fsharpforfunandprofit.com/
mdm12 · 2023-11-05
I would recommend two. F# in Action [1] by Isaac Abraham is a great (and recent) introduction to the F# language. For a more philosophical, domain-oriented book, you can't go wrong with Scott Wlaschin's Domain Modeling Made Functional book[2]. Scott's blog[3] is also must-read material.
[1] https://www.manning.com/books/f-sharp-in-action
[2] https://pragprog.com/titles/swdddf/domain-modeling-made-functional/
[3] https://fsharpforfunandprofit.com/
runevault · 2023-02-14
Same guy posts a lot of information about the topics on his website[1] as well. For anyone who isn't anti dotNet for various reasons such as being from Microsoft I recommend giving F# a try, it is a very nice language.
[1] - https://fsharpforfunandprofit.com/
ducharmdev · 2022-06-22
While I like the functional aspects of Rust, not sure I would call it a functional language - still very much worth learning though.
Maybe a slightly unconventional answer, but F# is quite nice.
https://fsharpforfunandprofit.com/
xupybd · 2022-06-06
I've been learning F# and the docs are the best I've read.
The Emlish book is great.
https://zaid-ajaj.github.io/the-elmish-book/#/
Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#
Book by Scott Wlaschin is amazing. His blog is also fantastic.https://fsharpforfunandprofit.com/
Get Programming with F#
A guide for .NET developers by
Isaac Abraham is also very good.
Not F# but the best written technical book I've read has to be The Pragmatic Programmer
Book by Andy Hunt and Dave Thomas.
An example of making a boring technical topic into an engaging novel is The Goal
Novel by Eliyahu M. Goldratt
goto11 · 2020-11-12
True, but the code examples in the BCL documentation is to show how to use the API, not to teach the languages. See something like F# for Fun and Profit https://fsharpforfunandprofit.com/ to learn to write idiomatic F#.
More F# documentation and support from MS would be great, but IMHO F# examples in the BCL documentation would not be the best use of resources.
modernerd · 2020-11-12
https://fsharpforfunandprofit.com/ is also great once you have the tooling installed.
dangets · 2020-11-03
I agree in the difficulty of finding abundant, good examples for F#. I'll throw out some plugs for ones that I liked.
* https://pragprog.com/titles/swdddf/domain-modeling-made-functional/ Uses F# as implementation language, though I cannot recommend this book enough for general type-safe design modeling regardless of the language.
* https://fsharpforfunandprofit.com/ Website of the author of the book mentioned above. He also has some good Youtube videos on the topic.
* https://www.demystifyfp.com/FsApplied/ A book that will walk you though developing a webserver, and also introduces you to Paket for dependency management.
I don't develop F# (or .NET) professionally, but I had fun when I played around with it. I found the interop with C# very seamless as well.
ducaale · 2020-10-09
I was to introduced to F# through the excellent fsharpforfunandprofit blog[1]. I wonder if there is a similar thing for other ML-like languages
[1] https://fsharpforfunandprofit.com
dustinmoris · 2019-12-26
Scott Wlaschin is one of my favourite tech speakers of all time. Every single talk I've seen by him has been excellent in explaining rather confusing topics in a really simple and innovative manner. His material was my goto source when I was learing functional programming and I'm not sure if I would have ever gotten even excited about it if it wasn't for one of his talks.
Follow him on Twitter:
https://twitter.com/ScottWlaschin
Check out his website F# for fun and profit:
https://fsharpforfunandprofit.com/
nickpeterson · 2019-06-11
I got really into F# for a couple years, and so Mark Seemann was someone I would read and watch quite often. Something I've noticed, is that F# has had very little impact as a language, but the small group of people involved with it seem really worth paying attention to. I feel like there is a chance that F#'s major contribution to programming will be its enthusiasts more than its project. For instance, check out this site by Scott Wlaschin. http://www.fsharpforfunandprofit.com
markdoubleyou · 2018-09-07
The "F# for fun and profit" site by Scott Wlaschin is a great jumping-off point: https://fsharpforfunandprofit.com/
I discovered it when I was reading a lot about domain driven design, and I stumbled upon a talk by the author that kind of blew my mind:
"Domain Modeling Made Functional" https://www.youtube.com/watch?v=Up7LcbGZFuo
davidgl · 2018-03-25
Brilliant introduction to static FP, uses F# but applicable to Elm, Occaml, Purescript, Haskell, etc.
https://fsharpforfunandprofit.com/
btschaegg · 2018-02-13
I've bought and worked through "Get programming with F#"[1] and liked it. It isn't finished yet (it's still in Manning's early access program), and it skips a lot of more in-depth topics, but it was good in helping me to get going without any previous experience in ML-style languages.
[1]: https://www.manning.com/books/get-programming-with-f-sharp
Edit: Also, I'd guess "F# for Fun and Profit"[2] technically counts, too. It's a really great resource for starting out with F# - Scott Wlaschin also has posted a few talks on specific subjects that he tackles with F#. I really liked his talk on "Railway oriented Programming", for example. It's also a good start to look at practical examples of monads :)
[2]: https://fsharpforfunandprofit.com/
yen223 · 2017-08-26
I highly recommend https://fsharpforfunandprofit.com/. F# is spiritually similar to OCaml, so there's a lot of crossover there. This is geared towards "enterprise" developers, and so tends to be more pragmatic than most other resources.
For what it's worth, I got a surprising amount of mileage from learning Idris[0], of all things. Even if you ignore the dependent type system, it is still essentially Haskell but with a lot of the warts removed, making it much simpler to grok.
Beyond that, the usual recommendations apply: Learn You a Haskell[1], and Real World OCaml[2] were what got me started.
[0] http://docs.idris-lang.org/en/latest/
[1] http://learnyouahaskell.com/chapters
[2] http://dev.realworldocaml.org/
oxryly1 · 2017-07-28
https://fsharpforfunandprofit.com is great. I'm enjoying Don Syme's book "Expert F# 4.0" as well.
jackfoxy · 2017-04-15
The community surrounding F# today is very supportive and helpful with people of all experience levels. Compared to when I learned F# in 2010 it is orders of magnitude easier and more social. So many resources: the F# Foundation website http://fsharp.org/ is a good place to start. http://fsharpforfunandprofit.com/ and the book form of the site's articles on github https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/site-conte… has great information for people at all levels. And finally just get on twitter #fsharp to start meeting people in the community.
steego · 2017-02-22
Just a reminder: Scott Wlaschin's book, F# for fun is a great free resource for people interested in F#. It's available here: https://fsharpforfunandprofit.com/
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.
pryelluw · 2017-02-10
I just started learning F# with the help of a well known F# dev. It's been a fun challenge. Give yourself the chance to try it out. Do check out http://fsharpforfunandprofit.com Its a great resource.
insulanian · 2016-06-10
This is the best resource by far: http://fsharpforfunandprofit.com
Update: There is also a collection of good books, videos, etc. here: http://fsharpworks.com/materials.html
ZenoArrow · 2016-01-26
Learn F#. It's basically OCaml for .NET (there are some differences between them, but they're very similar). You get great tooling, a huge library of functions (F# supports all .NET libraries), a welcoming community, and the language itself is very well thought out.
If you decide you'd like to learn OCaml at a later date, you'll find it easy if you've already learnt F#.
With regards to web frameworks, you've got some good options, ranging from heavyweight frameworks like WebSharper, to lightweight frameworks like Suave.
Much of F# is cross platform too. It's been open source for a long time, and runs fine on Mono.
If you'd like some extra information about F#, I'd recommend the website 'F# for fun and profit':
http://fsharpforfunandprofit.com/
solutionyogi · 2015-11-13
As a free resource, I would highly recommend http://fsharpforfunandprofit.com/
If you know C# well, this article should definitely open your eyes about what F# brings to the table:
http://fsharpforfunandprofit.com/posts/is-your-language-unreasonable/
110bpm · 2024-04-27
While the libraries and techniques I mentioned above seem to be well-known, I couldn't find a good public sample project.
I can recommend https://fsharpforfunandprofit.com/ as a starting point.
If there's interest, I can split some of my code into stand-alone chunks and post my experience of what worked well and what didn't.
I wanted to share some thoughts on here on what brought me to F#. Maybe this can serve as a starting point for people who have similar preferences and don't know much about F# yet.
A big part that affects my choice of programming language is its type system and how error handling and optionality (nulls) are implemented.
That "if it compiles, it runs" feeling, IMO, isn't unique to Rust, but is a result of a strong type system and how you think about programming. I have a similar feeling with F# and, in general, I am more satisfied with my work when things are more reliable. Avoiding errors via compile-time checks is great, but I also appreciate being able to exclude certain areas when diagnosing some issue.
"Thinking about programming and not the experience" the author lamented in the blog post appears to be the added cost of fitting your thoughts and code into a more intricate formal system. Whether that extra effort is worth it depends on the situation. I'm not a game developer, but I can relate to the artist/sound engineer (concept/idea vs technical implementation) dichotomy. F#'s type system isn't as strict and there are many escape hatches.
F#…
Leftium · 2023-07-11
"FP works great for distributed systems, and most software written today is distributed."
According to Grokking Simplicity[1], good functional programming isn't about avoiding impure functions; instead extra care is given to them. These functions depend on the time they are called, so they are the most difficult to get right.
Compare to pure functions: given the same input, the results are always the same regardless of when the function was called. So they are easier to reason with.
There is actually a level that is even easier to reason about than pure functions: plain data.
So functional programmers prefer data over pure functions over impure functions.
The reason to avoid "leaks" is because impure functions cause everything that calls them to also become impure. However, it is OK to use local mutation contained to the function itself. Sometimes mutation is simpler and doesn't affect the purity of the function that contains it.
Another good book on practical functional programming is Domain Modeling Made Functional[2]. Actually all of Scott Wlaschin's material[3] is very good!
[1]: https://www.manning.com/books/grokking-simplicity
[2]: https://pragprog.com/titles/swdddf/domain-modeling-made-functional/
[3]: https://fsharpforfunandprofit.com/
doorhammer · 2023-06-05
A bunch of ppl mentiond C#/F# so figured I'd just make a top-level response with some thoughts.
I wrote C# professionally for about five years (and actually just got a new job writing it again) and I spent about three writing production Go code. I love C# (it's my favorite overall language) and respect Go, though I personally don't enjoy the language.
There's definitely a concern about C# getting larger and larger, and while you can write in a functional/declarative style with things like LINQ (I'm mostly talking about the library, not the SQL'ish syntax), it's still very much OOP by default--at least in my experience, but you can write it in a very clean OOP way. That said, Go's philosophy about language size is almost the polar opposite of C#, and there's definitely a new-dev rampup that can come with it.
If you're looking for a type system with tagged unions/sum types then C#'s not going to do much for you there. That's actually the main thing I personally miss in it as well. There have been long-running design conversations about adding it, but hasn't happened (and I get why).
Here's a link to an interview with Mads Torgersen who runs the C# design stuff at MS where he talks about it, if you're interested (it's a super interesting conversation overall and I love listening to Mads talk about design):
https://youtu.be/Nuw3afaXLUc?t=3804
I can't really speak to the AOT compilation stuff since I've never had to do that with C#, but dang it's convenient with…
humanfromearth9 · 2022-11-06
Hello,
Apart from my family and some minor health issues, I currently am focused on 2 things: learning Luxembourgish/Luxembourgian and develop a deep understanding of functional programming.
About the former one: that should help me find a job in some Luxembourgish administration (I really wish I'll be able to find one soon).Luxembourg might be a small country, but I think it's managed well, CTIE (Luxembourgish administration that manages most of the IT infrastructure and software used by the state) has quite smart and competent people (also some dumb ones, but where's that not the case?), and I think I like the culture, which is almost my own, as I grew up close to Luxembourg and even went to a german-speaking school, while speaking family-native French (I'm as fluent speaking German as French, no accent).
Regarding the latter one, I started applying functional programming principles early this year, almost as obstinately as I can (and as much as possible using Java 8 then now 17) (I've got more than 16 years of professional experience using Java, both as a developer and software architect).
This was just the beginning of a more insightful journey into new coding practices, which result from one principle I discovered this year: source code should never lie.
This became an evidence once I implemented and started to use my self-made "Maybe" type (a better Optional - Optional is quite weak if you want to avoid procedural programming). While using Maybe, it struck me…
bmitc · 2022-08-31
Yes, please do! Warning: F# will ruin other languages for you. I find it rather painful to work in basically anything else after using F#, with gradients of pain for different languages. Haha.
And that's a good question. I have basically every book written on F#, but I can't say I have ever used them for anything more than reference.
The official docs/guide/reference are actually really good, and I refer to them a lot when using some feature I'm not familiar with: https://docs.microsoft.com/en-us/dotnet/fsharp/what-is-fsharp
F# For Fun and Profit is well-known, but I can't say I use it a lot: https://fsharpforfunandprofit.com/
The same author's (Scott Wlaschin) book is very good: https://pragprog.com/titles/swdddf/domain-modeling-made-functional/
As for books, I have always liked:
* Functional Programming Using F# by Hansen and Rischel (might be too simple if you are already comfortable with functional programming and is out of date every now and then with changes to F# that's happened)
* Expert F# 4.0 by Don Syme and others (contains a lot of nice things by the designer of F#
One of the latest books is Stylish F# 6: Crafting Elegant Functional Code for .NET 6 by Kit Eason. I have the first edition but haven't read it.
My personal recommendation is to take the approach of type/domain driven design. That is, I start off every F# module the same:
1. Define my types with discriminated unions, records, type aliases (such as for tuples) or single case discriminated…