View Source Guesswork.Ast.Is (Guesswork v0.8.0)

Binds a variable or entity to a function (constraint). If a variable is used, the constraint is used to figure out its value. If an entity is used, the constraint is used to test validity.

Note that, if all the inputs are concrete, the computation for is can be resolved before Guesswork.Answer.Result.run/2 is called.

Summary

Types

opts_list()

@type opts_list() :: [{:halt_on_error, term()}]

t()

@type t() :: %Guesswork.Ast.Is{
  binding: Guesswork.Ast.Entity.t() | Guesswork.Ast.Variable.t(),
  func: Guesswork.Answer.Computation.func(),
  halt_on_error: boolean(),
  inputs: [Guesswork.Ast.Entity.t() | Guesswork.Ast.Variable.t()]
}

Functions

new(binding, inputs, func, opts \\ [])

Builds a new constraint.

The following fields are available:

  • :halt_on_error (term/0) - Indicates that, should this constraint produce a value that disagrees with the answer set or is invalid, Guesswork should stop searching. The default value is false.