{"id":20509968,"url":"https://github.com/deamondev/doobie-mtl-example","last_synced_at":"2026-05-02T11:40:26.959Z","repository":{"id":133415671,"uuid":"495388016","full_name":"DeamonDev/doobie-mtl-example","owner":"DeamonDev","description":"Example of how to use Monad Transformers Library together with Doobie","archived":false,"fork":false,"pushed_at":"2022-05-23T12:41:22.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T08:39:54.369Z","etag":null,"topics":["doobie","error-handling","monad","mtl","postgresql","scala","shell"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeamonDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-23T11:48:38.000Z","updated_at":"2022-05-23T12:13:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"3809cf4f-2c42-4551-9f95-0e7b7e485794","html_url":"https://github.com/DeamonDev/doobie-mtl-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeamonDev%2Fdoobie-mtl-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeamonDev%2Fdoobie-mtl-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeamonDev%2Fdoobie-mtl-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeamonDev%2Fdoobie-mtl-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeamonDev","download_url":"https://codeload.github.com/DeamonDev/doobie-mtl-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242112499,"owners_count":20073613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doobie","error-handling","monad","mtl","postgresql","scala","shell"],"created_at":"2024-11-15T20:27:15.887Z","updated_at":"2026-05-02T11:40:21.920Z","avatar_url":"https://github.com/DeamonDev.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doobie-MTL\n\nIn this application I show how to manage (functional) error handling in the context of Doobie. We have database\n`manifolds_atlas` with table `algebraic_varieties`. Each variety has its id, name, equation describing it and its euler characteristics. \nIf you are not familiar with algebraic topology / geometry you can think about it as an abstract nonsense ;) \n\n## Prepare database (under postgres user)\n\nTo prepare database you just need to run the shell script\n\n```shell\n$ ./postgres.sh\n```\n\n## Two services\n\nThere are two services `ManifoldsAtlas` and `ManifoldsAtlasMTL`. To each of them we inject the DB connection. First one \ndeals with errors using ADT `Either[Error, *]`. The problem with this solution is that we need to lift critical errors (e.g. \ndatabase connector problems) to the domain errors. The second approach uses Typelevel's [MTL](https://typelevel.org/cats-mtl/getting-started.html) \nto 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 \n(injected, in a sense to an effect type). \n\nThis program was inspired after reading very good [article](https://guillaumebogard.dev/posts/functional-error-handling/?utm_source=pocket_mylist) written by Guillaume Bogard. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeamondev%2Fdoobie-mtl-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeamondev%2Fdoobie-mtl-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeamondev%2Fdoobie-mtl-example/lists"}