Skip to content

Instantly share code, notes, and snippets.

View ivanopagano's full-sized avatar

Ivano Pagano ivanopagano

View GitHub Profile
@ivanopagano
ivanopagano / README.md
Created March 10, 2020 17:25 — forked from anonymoussprocket/README.md
Tezos Token Tantrum
@ivanopagano
ivanopagano / README.md
Created March 10, 2020 17:25 — forked from anonymoussprocket/README.md
Tezos Token Tantrum
@ivanopagano
ivanopagano / tuple-flatten.scala
Created February 19, 2019 15:51 — forked from travisbrown/tuple-flatten.scala
Flattening deeply nested tuples with Shapeless
import shapeless._
trait Flatten[I, O <: HList] {
def apply(i: I): O
}
trait FlattenLow {
implicit def otherFlatten[I] = new Flatten[I, I :: HNil] {
def apply(i: I) = i :: HNil
}

Revisiting Tagless Final Interpreters

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA

package org.iainhull.akka
import scala.concurrent.duration._
import akka.actor._
import akka.event.Logging
import akka.pattern.ask
import akka.util.Timeout
import akka.persistence.{PersistentView, AtLeastOnceDelivery, PersistentActor}