O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

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

How it works...

We use MVar t as a mutable location, that is either empty or contains a value of type t. We also use Chan which wraps up MVar as a stream. A Chan represents a FIFO stream. In this recipe, we use Chan to send orders simultaneously from multiple threads to a single channel Exchange. We then use backend processor processOrder which uses an MVar for aggregating all these orders by in a single Map. The following diagram, explains the order processing system:

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