Jindřich Ivánekjindraivanek.hashnode.dev·a day agoF# tips weekly #11: Active patterns (2)Continuing from the previous week, let's delve into some active pattern implementation details and advanced use cases. Single-case active pattern As mentioned in Tip #2, we can use a single-case active pattern to directly transform a value: let (|Fro...Discuss·45 reads#fsharp
Jindřich Ivánekjindraivanek.hashnode.dev·Mar 21, 2024F# tips weekly #10: Active patterns (1)Active patterns are a great and unique feature of F#, allowing us to extend pattern matching with custom cases. Partial Active Patterns The most basic usage is to use active patterns as switches based on input value: let (|PositiveInt|_|) x = if ...Discuss·389 readsF# tips weeklyF#
Jindřich Ivánekjindraivanek.hashnode.dev·Mar 14, 2024Infinity ♾ forecast bugAt one of our customer project at Ciklum Western Europe, we encountered an interesting bug after migrating to .NET8 from .NET6. The project is a weather forecast service written in F# that provides weather forecast data from various weather forecast ...Discuss·186 readsdotnet
Jindřich Ivánekjindraivanek.hashnode.dev·Mar 7, 2024F# tips weekly #9: ShadowingShadowing is one of the core design choices of the F# language. Although it may seem like a simple feature, allowing us to define a new binding with the same name as an existing one, there are multiple, sometimes surprising, implications and use case...Discuss·1 like·261 readsF# tips weekly#fsharp
Jindřich Ivánekjindraivanek.hashnode.dev·Feb 29, 2024F# tips weekly #8: Custom equality and comparison (2)This week, we continue with custom comparison. Let's deep dive into writing custom comparisons. If we examine the last example of custom comparison: [<CustomEquality; CustomComparison>] type Record = { Id: int; Name: string; ActivityLog: string list ...Discuss·1 like·198 readsF# tips weekly#fsharp
Jindřich Ivánekjindraivanek.hashnode.dev·Feb 22, 2024F# tips weekly #7: Custom equality and comparison (1)Last week, we explored structural equality and comparison. This week, we'll look how structural equality and comparison is implemented, and how we can alter default behavior, or define custom comparisons and equality for our types. Equals, GetHashCod...Discuss·2 likes·210 readsF# tips weekly#fsharp
Fxplorerblog.fxplorer.net·Feb 19, 2024Thoughts on Avalonia UIAfter searching for a long time, I have settled on using the Avalonia UI framework as my base for software. My desired language is F#, which I have followed for more than 10 years but still am a newbie. I have accepted that my sweet spot is more in t...Discuss·1 likeavalonia
Jindřich Ivánekjindraivanek.hashnode.dev·Feb 15, 2024F# tips weekly #6: Structural equality and comparisonCore F# types, such as records, discriminated unions, and tuples, are compared by their structure, not by reference. That allows us to work efficiently with immutable data structures without surprises. Let's look at some details. Eligible types Struc...Discuss·221 readsF# tips weekly#fsharp
Jindřich Ivánekjindraivanek.hashnode.dev·Feb 8, 2024F# tips weekly #5: Discriminated Union TypesThis week, we'll look at some interesting details about Discriminated Union types. Tuple vs. Multiple Fields There is a subtle difference between these two cases of Discriminated Union (DU): type DU = | A of int * string | B of (int * string...Discuss·2 likes·338 readsF# tips weekly#fsharp
Jindřich Ivánekjindraivanek.hashnode.dev·Feb 1, 2024F# tips weekly #4: Record typesThe record type is a core feature in F#, but some of its details are not well-known. Let's delve into them. Type Inference Type inference in F# may sometimes deduce a record type differently than expected. For instance, in the following code, r is in...Discuss·3 likes·541 readsF# tips weekly#fsharp