Ask

com.softinio.verdict4s.Ask
See theAsk companion class
object Ask

Building an Ask from one or more questions, and the type that computes its answers.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Ask.type

Members list

Type members

Types

type Answers[Q <: Tuple] = InverseMap[Q, Question]

The positionally exact answer tuple for a tuple of questions.

The positionally exact answer tuple for a tuple of questions.

Tuple.InverseMap is what does the work: given (Question[A], Question[B]) it reduces to (A, B). It only reduces because every Question.* constructor returns the opaque Question[X] itself, uniformly and with an explicit return type.

Attributes

Value members

Concrete methods

def apply[Q <: Tuple](questions: Q)(using IsMappedBy[Question][Q]): Ask[Q]

Ask several questions together.

Ask several questions together.

Ask(urgency, team, frustration) // or Ask((urgency, team, frustration))

One method rather than an overload per arity: Scala tuples the arguments for you. It does not clash with the single-question overload below, whose erased signature differs by the evidence parameter.

IsMappedBy is what rejects a tuple holding something that is not a question.

There is no arity limit of ours. Jev documents none either -- it caps Choice options and Score levels, not how many questions a request carries, and its own examples batch more than a dozen, since one request is markedly cheaper and faster than several. OpenAI Decisions caps a request at 200 questions, which its protocol checks before sending.

In practice Scala's tuple-literal syntax stops at 22, which is also the largest result a caller can unpack with val (a, b, ...) =. Beyond that, build the tuple with *: and pass it here.

Attributes

def apply[A](question: Question[A]): Ask[Question[A] *: EmptyTuple]

Ask a single question.

Ask a single question.

Needed separately because one argument cannot be tupled into a 1-tuple.

Attributes

def defaultKey(index: Int): String

Positional question keys.

Positional question keys.

Zero padded so that lexicographic order matches positional order for the first hundred questions (q100 sorts before q11), which keeps the encoded request readable and its golden tests stable. Padded by hand rather than with f"q$i%02d", because Scala.js implements java.util.Formatter only partially.

Attributes