Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 1.25 KB

README.md

File metadata and controls

23 lines (16 loc) · 1.25 KB

Doobie-MTL

In this application I show how to manage (functional) error handling in the context of Doobie. We have database manifolds_atlas with table algebraic_varieties. Each variety has its id, name, equation describing it and its euler characteristics. If you are not familiar with algebraic topology / geometry you can think about it as an abstract nonsense ;)

Prepare database (under postgres user)

To prepare database you just need to run the shell script

$ ./postgres.sh

Two services

There are two services ManifoldsAtlas and ManifoldsAtlasMTL. To each of them we inject the DB connection. First one deals with errors using ADT Either[Error, *]. The problem with this solution is that we need to lift critical errors (e.g. database connector problems) to the domain errors. The second approach uses Typelevel's MTL to avoid such a lifting, allowing us to have two error channels. The one for domain errors (managed by ADT) and the one for critical errors (injected, in a sense to an effect type).

This program was inspired after reading very good article written by Guillaume Bogard.