Skip to content

Instantly share code, notes, and snippets.

@rudogma
Created June 27, 2017 10:09
Show Gist options
  • Save rudogma/444b5e87b512398bcbc2921724911a11 to your computer and use it in GitHub Desktop.
Save rudogma/444b5e87b512398bcbc2921724911a11 to your computer and use it in GitHub Desktop.
Special for Oleg
import scala.language.implicitConversions
object Test extends App {
testShapeless()
TestSupertagged.testSupertagged()
def testShapeless(){
import shapeless.newtype
println("testShapeless")
trait Step
val a = newtype.apply[Int,Step](5)
println("A: "+a)
}
}
object TestSupertagged {
import supertagged._
type NewType[T,U] = { type Bla = Tag[T,U] }
def onlyTag[T,U](v:T @@ U):NewType[T,U] = v.asInstanceOf[T with NewType[T,U]]
def testSupertagged(){
println("testSupertagged")
object Step extends TaggedType[Int]
type Step = Step.Type
val a:Step = Step @@ 5
val b = onlyTag(a)
println(s"b: ${b}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment