Skip to content

Instantly share code, notes, and snippets.

@dabd
Created April 1, 2016 07:54
Show Gist options
  • Save dabd/fe3e43ef81d974ad4d0153a9d71ff729 to your computer and use it in GitHub Desktop.
Save dabd/fe3e43ef81d974ad4d0153a9d71ff729 to your computer and use it in GitHub Desktop.
import shapeless.tag
import shapeless.tag._
implicit def toTaggedType[U, T](u: U): U @@ T = tag[T](u)
//implicit def toTaggedString[T](s: String): String @@ T = tag[T](s)
trait MyTag
def foo(s: String @@ MyTag): String @@ MyTag = s
foo("bar")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment