ask/predicate

Types

pub type Predicate(a) =
  fn(a) -> Bool

Functions

pub fn all(p: fn(a) -> Bool) -> fn(List(a)) -> Bool

Create a new predicate that returns True if the given predicate returns True for every element in a list.

pub fn always() -> fn(a) -> Bool

Create a new predicate that always returns True.

pub fn and(
  first: fn(a) -> Bool,
  second: fn(a) -> Bool,
) -> fn(a) -> Bool

Combine two predicates together into a new predicate that returns True if both predicates return True.

pub fn any(p: fn(a) -> Bool) -> fn(List(a)) -> Bool

Create a new predicate that returns True if the given predicate returns True for any element in a list.

pub fn every(ps: List(fn(a) -> Bool)) -> fn(a) -> Bool

Combine a list of predicates together into a new predicate that returns True if all predicates return True.

pub fn map_input(
  over p: fn(a) -> Bool,
  with fun: fn(b) -> a,
) -> fn(b) -> Bool

Map the input of a predicate to create a new predicate.

pub fn negate(p: fn(a) -> Bool) -> fn(a) -> Bool

Negate a predicate.

pub fn never() -> fn(a) -> Bool

Create a new predicate that always returns False.

pub fn or(
  first: fn(a) -> Bool,
  second: fn(a) -> Bool,
) -> fn(a) -> Bool

Combine two predicates together into a new predicate that returns True if either predicate returns True.

pub fn some(ps: List(fn(a) -> Bool)) -> fn(a) -> Bool

Combine a list of predicates together into a new predicate that returns True if any predicate returns True.

Search Document