package ego

  1. Overview
  2. Docs

The module Query encodes generic patterns (for both matching and transformation) over expressions and is part of Ego.Generic's API for expressing rewrites.

type 'sym t

Represents a query over expressions in a language with operators of type 'sym.

val of_sexp : (string -> 'a) -> Sexplib0.Sexp.t -> 'a t

of_sexp f s constructs a query from a sexpression s using f to convert operator tags.

val to_sexp : ('a -> string) -> 'a t -> Sexplib0.Sexp.t

to_sexp f q converts a query q to a sexpression using f to convert operators in the query to strings.

val pp : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a t -> unit

pp f fmt q pretty prints a query q using f to print the operators within the query.

val show : (Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> string

show f q prints a query q to string using f to print operators within the query.