Hey there 😃

Welcome to the documentation of decrel!

I appreciate your interest in the library, and I hope you will learn what you want to know on these pages.

If something is unclear, or if you have a suggestion, please don't hesitate to point it out in the discussions sectionopen in new window in Github, or email me.


The implicit knowledge of relations, usually present in the domain of an application, are rarely directly used when building applications in Scala.

In fact, in my experience, they are rarely even documented.

decrel aims to change the status quo; it is a library that allows the definition and utilization of relations between data.

What is it suitable for?

You will be able to create a value that represents something like:

  • I have an Employee object
  • Give me the Department object of that employee
    • Also give me the Employee object of the manager of that department
    • Also give me the list of Employees of that department

For this imaginary example, the expression would look something like this:

val query = Employee.department <>: (Department.manager & Department.employees)

Now, this query can exist in two completely different contexts, namely:

  • Fetching data from a datasource
  • Generating mock data

The above query can be used in both contexts, unmodified!

Anything else?

I gave a talk at the Functional Scala 2022 conference.

Due to time constraints, the talk is mostly focused on the motivation, and is rather light on the specific details.

You can watch it here:

Everything I said is still relevant, except for two details: