O'Reilly logo

Domain Modeling Made Functional by Scott Wlaschin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making Life Easier with Computation Expressions

So far we’ve been dealing with straightforward error-handling logic. We’ve been able to chain together Result-generating functions using bind; and for those functions that were not two-track, we’ve been able to make them fit the two-track model using various “adapter” functions.

Sometimes, though, the workflow logic is more complicated. You may need to work within conditional branches, or loops, or work with deeply nested Result-generating functions. In cases like these, F# offers some relief in the form of “computation expressions.” A computation expression is a special kind of expression block that hides the messiness of bind behind the scenes.

It’s easy to create your own computation expressions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required