I think a good way to understand them in F # is to look at what they mean using the syntax of the calculation expressions. I will write m for some compiler, but you can imagine that it is async or any other type of computation.
Left person
m { let! x' = m { return x } = m { let x' = x return! fx' } return! fx' }
Correct identity
m { let! x = comp = m { return! comp } return x }
Associativity
m { let! x = comp = m { let! y = m { let! x = comp let! y = fx return! fx } return! gy } return! gy }
Laws, in fact, tell you that you should be able to refactor one version of a program to another without changing the meaning - just like you can refactor regular programs in F #.
Tomas petricek
source share