package ego

  1. Overview
  2. Docs

Module Basic.RuleSource

This module encodes syntactic rewrite rules over Sexprs and is part of Ego.Basic's API for expressing syntactic rewrites.

Sourcetype t

Encodes a rewrite rule over S-expressions.

Sourceval pp : Format.formatter -> t -> unit

pp fmt r pretty prints the rewrite rule r.

Sourceval show : t -> string

show r converts the rewrite rule r to a string

Sourceval make : from:Query.t -> into:Query.t -> t option

make ~from ~into builds a syntactic rewrite rule from a matching pattern from and a result pattern into.

Iff into contains variables that are not bound in from, then the rule is invalid, and the function will return None.