Skip to content

Instantly share code, notes, and snippets.

View rudogma's full-sized avatar

Mikhail Savinov rudogma

View GitHub Profile
@rudogma
rudogma / 01 tag package.scala
Last active May 25, 2017 19:05
Tagging example for Folex
import scala.language.higherKinds
package object tag {
private def cast[T, U](v: U): T = v.asInstanceOf[T]
type Tag[T, +U] = {type Raw = T ; type Gag <: U }
type @@[T, +U] = T with Tag[T, U]
type Tagged[T, +U] = T with Tag[T, U]
def tag[T, U](value:T):T @@ U = cast(value)
@rudogma
rudogma / 01 tag3.scala
Last active May 24, 2017 06:59
Tagging & Multitagging
import scala.language.higherKinds
object tag3 {
private def cast[T, U](v:U):T = v.asInstanceOf[T]
type Tag[T, +U] = { type Raw = T ; type Gag <: U }
type @@[T, +U] = T with Tag[T, U]
type Tagged[T, +U] = T with Tag[T, U]