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

Chaining Result-Generating Functions

Before we deal with our specific situation, we should step back and look at the big picture. In general, if we have some Result-generating functions, how can we compose them together in a clean way?

Here’s a visual representation of the problem. A normal function can be visualized as piece of railroad track:

images/single-track.png

But a function with a Result output can be visualized as a railroad track that splits into two, like this:

images/switch-track.png

I’m going to call these kinds of functions switch functions, after the railroad analogy. They’re ...

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