Skip to content

Instantly share code, notes, and snippets.

View satorg's full-sized avatar

Sergey Torgashov satorg

View GitHub Profile
@ChristopherDavenport
ChristopherDavenport / Lock.scala
Last active October 11, 2021 13:10
Reentrant Lock
import cats._
import cats.syntax.all._
import cats.data._
import cats.effect._
import cats.effect.syntax.all._
import cats.effect.std.Semaphore
trait Lock[F[_]]{ self =>
def lock: F[Unit]
def unlock: F[Unit]

Principled Meta Programming for Scala

This note outlines a principled way to meta-programming in Scala. It tries to combine the best ideas from LMS and Scala macros in a minimalistic design.

  • LMS: Types matter. Inputs, outputs and transformations should all be statically typed.

  • Macros: Quotations are ultimately more easy to deal with than implicit-based type-lifting

  • LMS: Some of the most interesting and powerful applications of meta-programming