use ;
use crate Domain;
use crate State;
pub
/// Create a [goal](crate::goals::Goal) that only succeeds if both sub-goals
/// succeed.
///
/// This is essentially an "AND" operation. The resulting state will be the
/// result of the combining the two sub-goals.
///
/// If the first goal fails, the second goal will not be attempted.
///
/// # Examples
///
/// Two successful goals allow values to flow between vars:
/// ```
/// use canrun::{Goal, both, unify, var};
/// use canrun::example::I32;
///
/// let x = var();
/// let y = var();
/// let goal: Goal<I32> = both(unify(y, x), unify(1, x));
/// let result: Vec<_> = goal.query(x).collect();
/// assert_eq!(result, vec![1])
/// ```
///
/// A failing goal will cause the entire goal to fail:
/// ```
/// # use canrun::{Goal, both, unify, var};
/// # use canrun::example::I32;
/// # let x = var();
/// let goal: Goal<I32> = both(unify(2, x), unify(1, x));
/// let result: Vec<_> = goal.query(x).collect();
/// assert_eq!(result, vec![]) // Empty result
/// ```