Skip to content

Instantly share code, notes, and snippets.

@sjmyuan
sjmyuan / Alacarte.scala
Created April 19, 2017 12:55 — forked from YoEight/Alacarte.scala
Scala DataType à la carte
object Alacarte {
trait Functor[F[_]]{
def map[A, B](fa: F[A])(f: A => B): F[B]
}
trait Eval[F[_]] {
def F: Functor[F]
def evalAlgebra(fa: F[Int]): Int
}
@sjmyuan
sjmyuan / type-bounds.scala
Created April 19, 2017 12:50 — forked from retronym/type-bounds.scala
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x