[][src]Module canrun::goals

Make declarative assertions about the relationships between values.

Goals provide a high level interface for defining logic programs. They are composable, with many higher level goals being made up of lower level primitives. Since the typical way of using goals are through simple functions, it is easy to build and reuse custom, first class goal constructors.

While State exposes a lower level API, in practice there really shouldn't be anything that can't be expressed using goals.

Re-exports

pub use cmp::*;
pub use ops::*;

Modules

cmp

Comparison goals including lt, lte, gt, gte, min and max.

ops

Operator goals including add, sub, mul and div.

project

Goals that deal with resolved values.

Macros

all

Create a goal that only succeeds if all sub-goals succeed.

any

Create a goal that yields a state for every successful sub-goal.

Structs

Goal

A container of one of many possible types of goals.

Functions

assert_1

Create a projection goal that succeeds if the resolved value passes an assertion test.

assert_2

Create a projection goal that succeeds if the resolved values pass an assertion test.

both

Create a goal that only succeeds if both sub-goals succeed.

custom

Create a goal that gives access to the underlying State struct.

either

Create a goal that succeeds if either sub-goal succeed.

lazy

Create a goal that is generated via callback just as it is about to be evaluated.

map_1

Create a projection goal that allows deriving one resolved value from the other.

map_2

Create a projection goal that allows deriving one resolved value from the other two.

project_1

Create a projection goal that allows creating a new goal based on the resolved value.

project_2

Create a projection goal that allows creating a new goal based on the resolved values.

unify

Create a goal that attempts to unify two values with each other.