package dunolint-lib

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module BlangSource

Boolean expressions.

A blang is a boolean expression built up by applying the usual boolean operations to properties that evaluate to true or false in some context.

Blang sexp syntax

The blang sexp syntax is almost exactly the derived one, except that:

1. Base properties are not marked explicitly. Thus, if your base property type has elements FOO, BAR, etc., then you could write the following Blang s-expressions:

    FOO
    (and FOO BAR)
    (if FOO BAR BAZ)

and so on. Note that this gets in the way of using the blang "keywords" in your value language.

2. And and Or take a variable number of arguments, so that one can (and probably should) write

(and FOO BAR BAZ QUX)

instead of

(and FOO (and BAR (and BAZ QUX)))
Sourcetype +'a t = private
  1. | True
  2. | False
  3. | And of 'a t * 'a t
  4. | Or of 'a t * 'a t
  5. | Not of 'a t
  6. | If of 'a t * 'a t * 'a t
  7. | Base of 'a

Note that the sexps are not directly inferred from the type below -- there are lots of fancy shortcuts. Also, the sexps for 'a must not look anything like blang sexps. Otherwise t_of_sexp will fail.

Sourceval compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
include Sexplib0.Sexpable.S1 with type 'a t := 'a t
Sourceval t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t

Smart constructors that simplify away constants whenever possible

Sourcemodule type Constructors = sig ... end
include Constructors
Sourceval base : 'a -> 'a t
Sourceval true_ : _ t
Sourceval false_ : _ t
Sourceval constant : bool -> _ t

function true -> true_ | false -> false_

Sourceval not_ : 'a t -> 'a t
Sourceval and_ : 'a t list -> 'a t

n-ary And

Sourceval or_ : 'a t list -> 'a t

n-ary Or

Sourceval if_ : 'a t -> 'a t -> 'a t -> 'a t

if_ if then else

Sourcemodule O : sig ... end
Sourceval eval : 'a t -> ('a -> bool) -> bool

eval t f evaluates the proposition t relative to an environment f that assigns truth values to base propositions.