Skip to content

Instantly share code, notes, and snippets.

@jrudolph
Created April 29, 2015 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrudolph/a16af22fcbb3954be1b0 to your computer and use it in GitHub Desktop.
Save jrudolph/a16af22fcbb3954be1b0 to your computer and use it in GitHub Desktop.
ParameterDirectives
// generated using a simple showTree macro:
parameter("name") // expands to:
parameters(directives.this.ParamDefMagnet.apply[String]("name")(directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String])))))
parameter("name", "address") // expands to (shapeless 1):
parameters(directives.this.ParamDefMagnet.apply[(String, String)](scala.Tuple2.apply[String, String]("name", "address"))(directives.this.ParamDefMagnet2.forTuple[(String, String), shapeless.::[String,shapeless.::[String,shapeless.HNil]], this.Out](shapeless.this.HListerAux.tupleHLister2[String, String], directives.this.ParamDefMagnet2.forHList[shapeless.::[String,shapeless.::[String,shapeless.HNil]]](shapeless.this.LeftFolder.leftFolder[shapeless.::[String,shapeless.::[String,shapeless.HNil]], spray.routing.Directive0, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.R](shapeless.this.LeftFolderAux.hlistLeftFolderAux[String, shapeless.::[String,shapeless.HNil], spray.routing.Directive0, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.R, this.R](ParamDefMagnet2.this.MapReduce.from[String, shapeless.HNil, shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.HNil]](directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String]))), shapeless.this.PrependAux.hnilPrepend[shapeless.::[String,shapeless.HNil]]), shapeless.this.LeftFolderAux.hlistLeftFolderAux[String, shapeless.HNil, this.R, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.R, this.R](ParamDefMagnet2.this.MapReduce.from[String, shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.::[String,shapeless.HNil]]](directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String]))), shapeless.this.PrependAux.hlistPrepend[String, shapeless.HNil, shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.HNil]](shapeless.this.PrependAux.hnilPrepend[shapeless.::[String,shapeless.HNil]])), shapeless.this.LeftFolderAux.hnilLeftFolderAux[this.R, spray.routing.directives.ParamDefMagnet2.MapReduce.type])))))))
// the same with shapeless 2:
parameters(directives.this.ParamDefMagnet.apply[(String, String)](scala.Tuple2.apply[String, String]("name", "address"))(directives.this.ParamDefMagnet2.forHList[(String, String), this.Repr]({
final class fresh$macro$359 extends AnyRef with shapeless.Generic[(String, String)] {
def <init>(): fresh$macro$359 = {
fresh$macro$359.super.<init>();
()
};
type Repr = shapeless.::[String,shapeless.::[String,shapeless.HNil]];
def to(p: (String, String)): fresh$macro$359.this.Repr = p match {
case (_1: String, _2: String)(String, String)((pat$macro$357 @ _), (pat$macro$358 @ _)) => shapeless.::.apply[String, shapeless.::[String,shapeless.HNil.type]](pat$macro$357, shapeless.::.apply[String, shapeless.HNil.type](pat$macro$358, shapeless.HNil))
};
def from(p: fresh$macro$359.this.Repr): (String, String) = p match {
case (head: String, tail: shapeless.::[String,shapeless.HNil])shapeless.::[String,shapeless.::[String,shapeless.HNil]]((pat$macro$357 @ _), (head: String, tail: shapeless.HNil)shapeless.::[String,shapeless.HNil]((pat$macro$358 @ _), shapeless.HNil)) => scala.this.Tuple2.apply[String, String](pat$macro$357, pat$macro$358)
}
};
new fresh$macro$359()
}, hlist.this.LeftFolder.hlistLeftFolder[String, shapeless.::[String,shapeless.HNil], spray.routing.Directive0, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.Result](directives.this.ParamDefMagnet2.MapReduce.from[String, shapeless.HNil, shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.HNil]](directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String]))), hlist.this.Prepend.hnilPrepend1[shapeless.HNil, shapeless.::[String,shapeless.HNil]]), hlist.this.LeftFolder.hlistLeftFolder[String, shapeless.HNil, this.Result, spray.routing.directives.ParamDefMagnet2.MapReduce.type, this.Result](directives.this.ParamDefMagnet2.MapReduce.from[String, shapeless.::[String,shapeless.HNil], shapeless.::[String,shapeless.HNil], this.Out](directives.this.ParamDefMagnet2.forString(unmarshalling.this.Deserializer.liftToSourceOption[String, String](unmarshalling.this.Deserializer.fromFunction2Converter[String, String](scala.this.Predef.$conforms[String]))), hlist.this.Prepend.hlistPrepend[String, shapeless.HNil, shapeless.::[String,shapeless.HNil]](hlist.this.Prepend.hnilPrepend1[shapeless.HNil, shapeless.::[String,shapeless.HNil]])), hlist.this.LeftFolder.hnilLeftFolder[this.Result, spray.routing.directives.ParamDefMagnet2.MapReduce.type])))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment