summaryrefslogtreecommitdiff
path: root/cask/src/cask/router/Misc.scala
blob: 438ec439f0fef7b8cdb79862e385a360fa1d5350 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package cask.router

import scala.annotation.StaticAnnotation


class doc(s: String) extends StaticAnnotation

/**
 * Models what is known by the router about a single argument: that it has
 * a [[name]], a human-readable [[typeString]] describing what the type is
 * (just for logging and reading, not a replacement for a `TypeTag`) and
 * possible a function that can compute its default value
 */
case class ArgSig[I, -T, +V, -C](name: String,
                                 typeString: String,
                                 doc: Option[String],
                                 default: Option[T => V])
                                (implicit val reads: ArgReader[I, V, C])

trait ArgReader[I, +T, -C]{
  def arity: Int
  def read(ctx: C, label: String, input: I): T
}