Macro paradise is a plugin for several versions of Scala compilers. It is designed to reliably work with production releases of
scalac, making latest macro developments available way before they end up in future versions Scala. Refer to the roadmap for the list of supported features and versions.
~/210x $ scalac -Xplugin:macro-paradise_*.jar -Xshow-phases phase name id description ---------- -- ----------- parser 1 parse source into ASTs, perform simple desugaring macroparadise 2 let our powers combine namer 3 resolve names, attach symbols to trees in paradise packageobjects 4 load package objects in paradise typer 5 the meat and potatoes: type the trees in paradise ...
Some features in macro paradise bring a compile-time dependency on the macro paradise plugin, some features do not, however none of those features need macro paradise at runtime. Proceed to the the feature list document for more information.
Consult https://github.com/scalamacros/sbt-example-paradise for an end-to-end example, but in a nutshell working with macro paradise is as easy as adding the following two lines to your build (granted you’ve already set up SBT to use macros).
resolvers += Resolver.sonatypeRepo("snapshots") addCompilerPlugin("org.scala-lang.plugins" % "macro-paradise" % "2.0.0-SNAPSHOT" cross CrossVersion.full)
To use macro paradise in Maven follow the instructions provided at Stack Overflow on the page “Enabling the macro-paradise Scala compiler plugin in Maven projects” (also make sure to add the dependency on the Sonatype snapshots repository and
<compilerPlugins> <compilerPlugin> <groupId>org.scala-lang.plugins</groupId> <artifactId>macro-paradise_<YOUR.SCALA.VERSION></artifactId> <version>2.0.0-SNAPSHOT</version> </compilerPlugin> </compilerPlugins>
Sources of macro paradise are available at https://github.com/scalamacros/paradise. There are branches that support several stable releases of 2.10.x, snapshots of 2.10 and 2.11, as well as Scala virtualized.blog comments powered by Disqus