HackerTrans
TopNewTrendsCommentsPastAskShowJobs

110bpm

21 karmajoined 2 anni fa

comments

110bpm
·anno scorso·discuss
I put together a quick-start guide to F# Computation Expressions — showing how you can go from C# async/await all the way to Result<> workflows with let!... and!... expressions, and even a custom validation {} CE. [0]

This is a practical side of F# that doesn’t get enough spotlight — but one I’m using daily.

[0]: https://news.ycombinator.com/item?id=42636791
110bpm
·anno scorso·discuss
`async` is F#'s original implementation of async programming. It is the precursor to C#'s await/async.

`task` targets the .NET TPL instead, which is also what C#'s await/async and all of .NET *Async methods use.

While the `async` implementation still offers some benefits over `task` (cold vs. hot starts [0]), my advice is - if you're doing backend code on .NET, you should use task. The tigher integration with the .NET ecosystem & runtime results in better exception stack traces, easier debugging and faster performance.

[0] https://github.com/TheAngryByrd/IcedTasks?tab=readme-ov-file...
110bpm
·anno scorso·discuss
This isn't such a big issue in my experience. Auto-formatting helps a lot, the code needs to be just syntactically correct.

The default F# autoformatter is bundled/supported by VS Code, VS and Rider [0].

[0]: https://fsprojects.github.io/fantomas/docs/end-users/StyleGu...