Skip to content

Instantly share code, notes, and snippets.

View teldosas's full-sized avatar

Aristotelis Dossas teldosas

  • Thessaloniki
View GitHub Profile
@teldosas
teldosas / Linear.scala
Last active January 14, 2017 14:05 — forked from limansky/Linear.scala
Linear type class
package me.limansky
import shapeless.ops.hlist.Prepend
import shapeless.{::, <:!<, Generic, HList, HNil, LabelledGeneric, Lazy}
import shapeless.labelled.FieldType
trait UnZip[-F,T] {
def apply(f: F): T
}
@teldosas
teldosas / genericNested.scala
Created January 12, 2017 10:43
Class for generating generic representations of nested case classes
import shapeless._
trait GenericNested[P] {
type Repr
def to(p: P): Repr
def from(o: Repr): P
}
class LowPriorityNested {
type Aux[P, Repr0] = GenericNested[P] { type Repr = Repr0 }
implicit def base[T] = new GenericNested[T] {