Skip to content

Instantly share code, notes, and snippets.

@harpocrates
Created August 23, 2016 06:48
Show Gist options
  • Save harpocrates/f55b5725a515706bd9c55291aa917fa4 to your computer and use it in GitHub Desktop.
Save harpocrates/f55b5725a515706bd9c55291aa917fa4 to your computer and use it in GitHub Desktop.
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
object Macro
// inspect how scala has desugared your code
def traceSugar[T](t: T): T = macro impl
def impl(c: Context)(t: c.Tree): c.Tree = { println(t); t }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment