package grace

  1. Overview
  2. Docs

Diagnostic types and constructors.

type ('a, 'b) format = ('a, Stdlib.Format.formatter, unit, 'b) Core.format4

The type of format strings associated with messages.

  1. The input is always a Format.formatter
  2. The result of %a and %t printing functions is unit.
module Severity : sig ... end

The type of severity.

module Priority : sig ... end

The type of priority. These are used to style the primary and secondary causes of a diagnostic.

module Message : sig ... end
module Label : sig ... end
type 'code t = {
  1. severity : Severity.t;
    (*

    The overall severity of the diagnostic.

    *)
  2. message : Message.t;
    (*

    The main message associated with the diagnostic. These should not include control characters (such as the newline character \n). To support compact rendering, the message should be specific enough to make sense on its own, without the additional context provided by labels and notes.

    *)
  3. code : 'code option;
    (*

    The (optional) error code assicoated with the diagnostic

    *)
  4. labels : Label.t list;
    (*

    Labels that describe the cause of the diagnostic. The order of the labels has no meaning, Grace's rendering engine will determine the order they appear.

    *)
  5. notes : Message.t list;
    (*

    Notes that are associated with the primary cause of the diagnostic.

    *)
}

The type of diagnostics.

include Sexplib0.Sexpable.S1 with type 'code t := 'code t
val t_of_sexp : (Sexplib0__.Sexp.t -> 'a) -> Sexplib0__.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0__.Sexp.t) -> 'a t -> Sexplib0__.Sexp.t
val create : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> Severity.t -> Message.t -> 'code t

create severity message constructs a diagnostic with the message.

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

  • parameter labels

    used to describe the cause of the diagnostic.

  • parameter code

    the error code of the diagnostic.

val createf : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> Severity.t -> ('a, 'code t) format -> 'a

createf severity fmt ... formats a message and constructs a diagnostic.

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

  • parameter labels

    used to describe the cause of the diagnostic.

  • parameter code

    the error code of the diagnostic.

val kcreatef : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> ('code t -> 'b) -> Severity.t -> ('a, 'b) format -> 'a

kcreatef kont severity fmt ... is equivalent to kont (createf severity fmt ...).

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

  • parameter labels

    used to describe the cause of the diagnostic.

OCaml

Innovation. Community. Security.