summaryrefslogtreecommitdiff
path: root/camlp4/ocaml_src/lib/extfun.mli
blob: 2d42fe2e8490d4f1a1369a96276fc4babef583e7 (plain)
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
(* camlp4r *)
(* This file has been generated by program: do not edit! *)

(** Extensible functions.

   This module implements pattern matching extensible functions.
   To extend, use syntax [pa_extfun.cmo]:

      [extfun e with [ pattern_matching ]] *)

type ('a, 'b) t;;
   (** The type of the extensible functions of type ['a -> 'b] *)
val empty : ('a, 'b) t;;
   (** Empty extensible function *)
val apply : ('a, 'b) t -> 'a -> 'b;;
   (** Apply an extensible function *)
exception Failure;;
   (** Match failure while applying an extensible function *)
val print : ('a, 'b) t -> unit;;
   (** Print patterns in the order they are recorded *)

(**/**)

type ('a, 'b) matching =
  { patt : patt; has_when : bool; expr : ('a, 'b) expr }
and patt =
    Eapp of patt list
  | Eacc of patt list
  | Econ of string
  | Estr of string
  | Eint of string
  | Etup of patt list
  | Evar of unit
and ('a, 'b) expr = 'a -> 'b option
;;

val extend : ('a, 'b) t -> (patt * bool * ('a, 'b) expr) list -> ('a, 'b) t;;