How to Troubleshoot Apps for the Modern Connected Worker
Getting the MVVM Kicked Out of Your F#'n Monads
1. Getting the MVVM kicked out of your F#'n Monads Richard Minerich F# MVP of the Year Senior Researcher, Bayard Rock @Rickasaurus / [email_address] Fill this space with whatever you want (graphic, logo, whatever)
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21. “ F# 2.0 is a book that assumes you are a professional, and as such, does not waste your time with a lot of fluff.”
22.
23. We thank the following companies for their gracious sponsorship Platinum Sponsor Gold Sponsors Silver Sponsors
Notes de l'éditeur
Where we put the parens doesn’t matter, the result will be equal
We can combine the functions by calling them one after another, but this isn’t really an operation, just passing
This ends up having same effect as stacking functions inside calls to each other, but is much more flexible. Now, we can do a lot of things with functions that would could only do with numbers before.
This is called the identity F# comes with the id function built in
This is called the identity F# comes with the id function built in
This is associativity all stateless functions share this property because execution is delayed
The >> operator demands associtivity and so everything must be defined in a way that enforces it
Because minusTwo, minusOne and minusThree are really the same as addNegativeOne, addNegativeTwo and addNegativeThree The order of calculation is in the order in which things are appended.
For this same reason, our addition functions have exactly the same properties as addition itself. You can put parans anywhere you want but you can’t reorder without breaking the function
But first we need to revisit some very basic math. Trust me, it will be worth it.
Computation expressions let us define the relationships between things in a specific context. Let’s take this apart.
But don’t worry, we’ll take it slow
Let’s take small steps first. Look at this code.
With this pattern, everything is designed in terms of merging containers, putting things in the container or pulling things out
With a maybe monad, we can pretend like the maybe isn’t even there