package rfsm

  1. Overview
  2. Docs
On This Page
  1. Annotations
Legend:
Library
Module
Module type
Parameter
Class
Class type

Annotations

type ('a, 'b) t = {
  1. mutable desc : 'a;
    (*

    Annotated value

    *)
  2. mutable typ : 'b;
    (*

    Type annotation (type 'b will be bound to the guest language type)

    *)
  3. loc : Location.t;
    (*

    Location in source code

    *)
}

The type ('a,'b) t is used to attach type and location annotations to values of type 'a.

val mk : loc:(Stdlib.Lexing.position * Stdlib.Lexing.position) -> typ:'b -> 'a -> ('a, 'b) t

mk ~loc ~ty x returns value x annotated with type ty and location loc

val map : ('a -> 'c) -> ('b -> 'd) -> ('a, 'b) t -> ('c, 'd) t

map f g v returns the annotated value obtained by applying f and g to the desc and typ fields of v resp., without changing the loc field.

OCaml

Innovation. Community. Security.