Discover and read the best of Twitter Threads about #fsharp

Most recents (17)

My 20 tips recipe for #fsharp web dev for fairly complex app, @fsharponline
1- Go MultiPage, Micro-frontends: A good book is here…
2-Use HTMX with giraffe but not Giraffe.HTMX, nor any engine just plain string interpolation with
Highlight templates in F#
3- For htmx use my fork as it supports shadow dom with more proper form validation, just grab the js file…
Use with alpine not hyperscript as alpinejs supports shadow dom
4- For shadow dom support you need to call process elements and alpine's initTree
5- Use Fable.Lit along with Vite for dynamic parts of app. Just bring your tag from serverside via htmx and Lit will render it. Bam!

6- Use Monolithic Elmish but also use Elmish store to break monolithsm where desired.
Read 9 tweets
A while ago I saw someone asking on resource to start learning #fsharp.
Now, as an F# Jedi-in-the-making (read: utter and total n00b), here are my very-not-definitive resource list.

A mega-🧵.
*Note*: I've *deliberately* decided to just state the resources *without* commenting on them.
I'm, like I wrote, an F# n00b and it's certainly not my place to rank or grade the works and efforts I list.

Seek the resources out and judge for yourselves!

* "Get programming with F#" by @isaac_abraham.
* "Stylish F#" (and now, 2nd version, "Stylish F# 6") by @kitlovesfsharp.
* "Domain modelling made functional" by @ScottWlaschin.
* "Essential functional-first F#" by @ijrussell (on @leanpub).
Read 10 tweets
Just finished an epic #fsharp coding binge this week. It was like plugging my brain directly into the machine. There was almost no impedance mismatch between forming a design intention and expressing it in code. I have never felt so productive.
The project is an internal tool that I can't talk too much about. Basically it's a console app that pulls data from different teams/departments and "joins" it together (normalizing disparate domain terminology) to produce various reports that it can dump to the screen or Excel.
Features that made this really easy:
- Type Providers (ExcelProvider FTW)
- Good old |> operator and your basic List/Seq/Array functions, which make much of the report-building logic look like KQL (more members of the team know KQL than F#)
Read 11 tweets
My #fsadvent post is up:
Functional Event Sourcing Decider…
At last, a full length blog post about functional #eventsourcing
@sergey_tihon here it is.
This is a long post based on my upcoming book about Functional Event Sourcing. Not ETA yet, but I thought I still needed to publish something at some point. There is of course far more content in the book 😁
Read 4 tweets
Great post. I think that skill floor/skill ceiling is a great framework for thinking about programming language accessibility. But I think there is more as well...
An important factor is not just the skill floor needed to get started, but the skill floor needed to understand (and maintain!) other people's code. That is, what skill level do you need to participate in a programming community?
For example, lisps have a very low skill floor, but my guess is that you need a high skill to participate in the current CL programming community. It's interesting to see the difference between CL people and Clojure here :)
Read 14 tweets
#fsharp people

One simple way to help F# is to help us fill in basic F# code samples for all the F# core library functions. These should have been done long ago, but let's do them now!

Here's an example of the sort of thing that needs to be added:…
Once integrated, your examples will appear in the F# core library docs here…
To make a contribution, simply send a pull request to There's also some more information here:…
Read 5 tweets
For all of the #fsharp bits I tweeted, this is the key takeaway. I can point a new developer on my team at this block of code and say "this is the protocol" and in a separate code file we have a concise FSM that processes all of these

Readably concise, immutable, and fully typed
Can't do that in C# without pressing F12 hundreds of times.
Not _quite_ fully typed - don't provide any hints on how the processor might respond. Not sure how I'd do that just yet.
Read 4 tweets
A thread about what we have learned after ~1y of #EventSourcing.
- Domains: Billing, Accounting, Cashflow.
- Volume: 750k events / day
- Services count: 10
- Private cloud/infra
- Stack: #fsharp / postgres / rabbitmq
Very opinionated, we're learning every day.
Without modeling, never create a new stream or add a new event. Your self-confidence could be your enemy.
Event names and event models must be double checked with the business and the team.
Events should always be business events.
Avoid using them or their fields as a logger (You have elastic for that).

"AlreadyReceived" for example, should not be an event but maybe a command error.
Read 13 tweets
One actual reason (for me) to use objects in #fsharp is polymorphic recursion in members; it is not available on functions. I wish there was a form of object expressions which immediately introduced a type without a separate interface or abstract type.
Example: one would expect this to work, because the function seemingly accepts any 'a but it doesn’t: let rec printSome (a : Option<‘a>) = match a with | Some a -> printfn a | None -> printSome (Some “Fake Some!”)
So when I really need such a function, I’d like to “wrap” it in a member with as little ceremony as possible. Kind of like Scala’s singleton objects. Now I need to define a boilerplate interface and “inplement” it in an object expression.
Read 3 tweets
Making illegal states unrepresentable without access to at least HKTs and preferrably also to GADTs and type families is so limited that it becomes almost futile. Or becomes very verbose in a similar way to having no polymorphism/“generics”. #fsharp #Haskell #ddd
Here is a type for a customer and address in pseudo-#fsharp syntax: type Customer f = Customer of Name * f<Adress>. Newly registered customer may or may not enter an address: register : ... -> Customer Option. But...
... placing an order requires the address to be known: placeOrder : ... -> Customer<Identity> -> Order. Where type Identity<a> = a.
Read 3 tweets
I write #fsharp and #haskell daily (and #purescript too) and thought of making a micro-blog comparison of the two. Fun facts and maybe new discoveries for the interested, in no particular order. This will be long and probably slow.
Unlike #fsharp, #haskell has no records, only discriminated unions. It does have something called “record syntax” for DUs.
In #fsharp functions cannot be overloaded. In #haskell it is possible through the “type classes” mechanism, conceived specifically for this.
Read 14 tweets
#fsharp Twitter is making fun of default interfaces, as usual somewhat ... uninformed. Imagine you are defining a set of operations on an ADT (abstract data type) where one operation can be implemented in terms of another. Then one of the two can be provided beforehand.
For types which admit more efficient implementation, the default implementation can be provided explicitly. Basic example of related operations: + and *.
Every applicative can be given a default implementation in terms of a monad, same for `map` and `bind` etc. Not that this one is usable in #fsharp with or without default interfaces though, but still a nice example.
Read 3 tweets
Interfaces are not functional, but inherently OO in the sense that there is always an object involved to which you send a message (= call member of the interface). So interfaces are contracts for objects (or values, but this does not help) and not for types. #fsharp
Programmers used to interfaces and not used to type classes rarely think of this example: wouldn’t it be natural and useful to have “empty collection” as part of, say, ICollection<‘t>? That would be a contract for type t itself as opposed to values of t. #fsharp
So static interface members are actually a very exciting feature which makes interfaces more functional and strictly more expressive and therefore useful. #fsharp
Read 3 tweets
Given a 3 week deadline, I just built a mobile app using #fsharp and #xamarinforms for emergency responders.

I applied techniques I learned from @ScottWlaschin 's book, @debasishg 's book, and @IDesign_inc 's book.
The mobile solution is partitioned into two sub-domains in which each layer (UI, Domain, Data Store) relies on their relative specification library. A specification library exposes business terminology as record or choice types and business policies as function types.
I spent the first 2 days domain-modeling.

I then put together a Project Design document that provided three options for how the application would be developed given the time constraints. These options included advantages and disadvantages for each option.
Read 9 tweets
I’ve been recently asked why I still use .Net if I hate it so much (concluding based on some of my tweets).

So here’s the point - I LIKE .NET. I think it’s really good technology in many aspects and really great choice for many types of problems.

I really like some of the stuff MSFT is doing with .Net - F# (😜), editor tooling services as part of compiler design (still concept totally foreign to many languages, especially FP), good improvements of .Net Core, performance magic in ASP .NET and more...

No one is pointing gun at me when I spend countless hours building OSS stuff on .Net, writing blog posts, or giving talks (especially in the places traditionally not using .Net) and promoting it.

Read 9 tweets
Wow, these results are sobering. In an effort to turn them around, I’m going to attempt a Twitter #monadtutorial. I realize this has probably been done before, but here goes anyway... 1/
This will not be Haskell-focused. Haskell was my first introduction to monads back in 1999, and it just confused the heck out of me. Instead I’ll use examples from #csharp and #fsharp, since they’re what I know best. 2/
First, ignore category theory jargon. Unless you’re doing actual math (or Haskell), “Monad” as a concept is far less important than its practical applications. So let’s start with what monads are good for, before getting into what they are. 3/
Read 28 tweets
“Active pattern-oriented programming” feels like a discipline within DDD on its own. #fsharp
Sort a list of values by a “binary” key, then mix nested, AND and OR (active) patterns with list cons pattern to detect patterns of complex data in the original list.
Sorting is meant to push all potentially interesting values to the start of the list and treat it kind of like a set in pattern matching.
Read 3 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!