Cite.Policy (Cite v0.1.0)

Copy Markdown View Source

A policy: what the source is judged against, declared once in a module.

defmodule MyApp.Riddles do
  use Cite.Policy

  concern :riddle do
    detect do
      question "Does {passage} pose a riddle?"
      yes "A question asked to be puzzled over."
      no "A plain question, a statement, or a remark."
    end
  end
end

Declarations: filter, concern (with category, detect, confirm, role, check), factor, score, choice. Every mistake is a compile error. Writing policies explains the language; the reference below, generated from the DSL, lists every declaration's arguments, options, and defaults (required ones starred).

policy

What the source is judged against.

Nested DSLs

policy.filter

filter name

A yes/no question every evidence passage must pass.

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.

policy.filter.yes

yes what \\ nil

What makes the answer yes: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.filter.no

no what \\ nil

What makes the answer no: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern

concern name

One kind of thing you want found: screened directly, or built from factors.

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
categoryatomWhat the finding is reported as.

policy.concern.detect

The concern's round-1 question, asked of every passage.

Nested DSLs

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.

policy.concern.detect.yes

yes what \\ nil

What makes the answer yes: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern.detect.no

no what \\ nil

What makes the answer no: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern.confirm

The concern's round-2 question, deciding which matched passages are cited.

Nested DSLs

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.

policy.concern.confirm.yes

yes what \\ nil

What makes the answer yes: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern.confirm.no

no what \\ nil

What makes the answer no: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern.role

role name

A role in a concern built from factors, filled by a factor's strongest match.

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
factoratomThe factor that fills the role.
optionalbooleanfalseThe finding may stand without it.
distinctbooleanfalseIt must be a passage no other role holds.

policy.concern.check

check name

A yes/no question across a concern's roles that decides whether it holds.

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.
distinctbooleanfalseAsk only when the named roles are different passages.

policy.concern.check.yes

yes what \\ nil

What makes the answer yes: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.concern.check.no

no what \\ nil

What makes the answer no: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.factor

factor name

A yes/no question that fills a role in a concern built from factors.

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.

policy.factor.yes

yes what \\ nil

What makes the answer yes: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.factor.no

no what \\ nil

What makes the answer no: a string, or a block with what, not_for, examples.

Arguments

NameTypeDefaultDocs
whatString.tWhat qualifies for this side.

Options

NameTypeDefaultDocs
not_forString.tWhat a reading of what might wrongly include.
exampleslist(String.t)Short phrasings that qualify.

policy.score

score name

A descriptor that places each finding on ordered levels.

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
levelslist(String.t)The levels, lowest first.
focusString.tOne line on what to attend to.

policy.choice

choice name

A descriptor that picks one option for each finding.

Nested DSLs

Arguments

NameTypeDefaultDocs
nameatomThe name.

Options

NameTypeDefaultDocs
questionString.tThe question, naming what it reads by placeholder.
focusString.tOne line on what to attend to.

policy.choice.option

option key, description

One option of a Choice.

Arguments

NameTypeDefaultDocs
keyatomThe option's key.
descriptionString.tWhat the option means.

Options

  • :extensions (list of module that adopts Spark.Dsl.Extension) - A list of DSL extensions to add to the Spark.Dsl

  • :otp_app (atom/0) - The otp_app to use for any application configurable options

  • :fragments (list of module/0) - Fragments to include in the Spark.Dsl. See the fragments guide for more.