Created
June 27, 2017 10:09
-
-
Save rudogma/444b5e87b512398bcbc2921724911a11 to your computer and use it in GitHub Desktop.
Special for Oleg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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