Skip to content
Simple example showing how to use the Tagless Final pattern to abstract over the effect
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

A Tagless Final example

This is a very basic example illustrating the Tagless Final pattern in Scala. Algebras are defined for a UserRepository and OrderRepository. Each algebra has a corresponding interpreter defined for the Cats Id and Monix Task effect. The Id interpreter is implemented using an in memory hashmap and the Task interpreter uses Doobie to query a Postgres database.

Please see my associated blog post

Note: This is deliberately simple, to illustrate the Tagless Final pattern. It's not intended to be an example of a production grade functional program!

Getting started

  1. Take a look at the algebras
  2. Take a look at the services which use the algebras
  3. See the inmemory and doobie based interpreters
  4. See how we wire up each interpreter by looking at the DoobieRunner and InMemoryRunner
You can’t perform that action at this time.