1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
(* camlp5r *)
(* extfun.mli,v *)
(* Copyright (c) INRIA 2007-2017 *)
(** Extensible functions.
This module implements pattern matching extensible functions.
To extend, use syntax [pa_extfun.cmo]:
[extfun e with [ pattern_matching ]] *)
type t 'a 'b = 'x;
(** The type of the extensible functions of type ['a -> 'b] *)
value empty : t 'a 'b;
(** Empty extensible function *)
value apply : t 'a 'b -> 'a -> 'b;
(** Apply an extensible function *)
exception Failure;
(** Match failure while applying an extensible function *)
value print : t 'a 'b -> unit;
(** Print patterns in the order they are recorded *)
(**/**)
type matching 'a 'b = { patt : patt; has_when : bool; expr : expr 'a 'b }
and patt =
[ Eapp of list patt
| Eacc of list patt
| Econ of string
| Estr of string
| Eint of string
| Etup of list patt
| Erec of list (patt * patt)
| Evar of unit ]
and expr 'a 'b = 'a -> option 'b;
value extend : t 'a 'b -> list (patt * bool * expr 'a 'b) -> t 'a 'b;
|