Monadic data query capability allows you to massage your data outside of your application code. In this way, you can build a data logic layer from multiple different data sources and much more. The benefit of using monadic operators as part of your business rules is that dealing with data (i.e., preparation, merging, combination, projection, etc.) can be part of your business logic process rather than the hard-coded data logic in your application. So, if the structure of the data or logic of the view is changed, you don't need to touch your application or service, you just need to update your monadic view in your externalized business logic. In the previous post we talked about monads and also, we put together an example of identifying duplicates using monadic operators.

To make it easier to discuss monads, let's assume the following data structure in an application:
business rules monad

In this post, we are going to talk about more advanced monadic operators. There are multiple different groups of monadic operators that help you in:
1. Joining
2. Grouping
3. Filtering and Ordering

And there are many other operators for which you can find the details at


There are multiple types of joins. In this article, we are going to describe two of them: InnerJoin and LeftJoin.

Inner Join

The inner join creates a new result collection by combining elements of two collections based upon the join-predicate:
Monad inner join
As the picture explains, the result (blue section) belongs to both collections.

In our example, we join Animals and Medication like this:
monad join business rule

And the result of this would be:

monad join business rule result

Left Join

LeftJoin does the same thing, but the difference is that all the values from first collection will be in the result:
What that means is if there is no corresponding item in the right collection, a ‘null' value is chosen.

monad left join rule engine

So, as a result what we have is:
left join monad rule engine


From a business logic stand point, this capability allows you to work with data and externalize the data logic from your applications or business processes. The possibilities are huge – you can now use multiple different data sources and work with data as part of your business logic models rather than your application codes or database queries! Once the data structure or source is changed, you just need to update your model without even touching your application.

The other use case of this can be, for instance, when you need to run a decision model, but your data input requires a form of processing before passing it to decision point. You don't need any coding to massage your data.
Here is another idea – build a dynamic dashboard that you can use to process the data, send it you decision model, and then process the result of the decision before showing it to the user. Neither of these steps require hard-coding your decision nor any data logic.

For more information please visit

Last updated September 22nd, 2020 at 11:30 am, Published April 14th, 2016 at 11:30 am