Giraffe is an F# ASP.NET Core web framework. It has quirks and patterns that I've never encountered before in C# or web programming. The HttpHandler is one of the patterns new to me. Lets take a look at one way to unit test these handlers to ensure our application is working as expected.
The HttpClient is the standard way to make web requests in .NET. Because F# is a functional language, it's usage is different than what you'd find in C#. Here are some examples of how to use the HttpClient in F#.
We all try to escape or avoid reality. But until we face it, we'll never grow. We not only need to face it, but embrace it. So many of our errors in life come from not properly understanding or avoiding reality. How can I get better at it?
State is the root of a lot of problems in a multi threaded environment. One of F# solves this problem is by it's MailboxProcessor. It's a technique that allows for communication in a way that avoids the inherent problems of storing and sharing state.
Elmish is a great UI building language. The todoapp is one of the best ways to see a UI language in action. Lets dive into the Elmish todo app and see what we can learn.
For loops are everywhere. Recursion is the functional way to iterate through a collection. There are pros and cons to using it over a for loop. Take a peak at what makes it useful and unique.
UI work is the wild west! Often it's just iterate until it works. Elmish provides a better set of tools to ensure your UI is working as expected. Why is it so useful? How does it allow you to write UIs that can be checked to ensure they're working as expected? Lets write a simple Elmish app to demonstrate it's many advantages.
Types Provides allows compile time checks for your application. Is your SQL syntax right? Are you correctly using the columns from that csv file? It provides a higher level of correctness in your code by having the compiler check your work. Lets walkthrough on what it takes to get a SQL type provider running in F# to ensure your SQL usage is accurate.
Functional Programming has certain design principles that make it better suited for solving problems with code. Currying is one of those features. Coming from C#, it might not be something that's ever seen on your radar. Knowing it and using it will make your code more readable and more composable.