| 1 | open! Base |
| 2 | open Ppxlib |
| 3 | |
| 4 | (** Represents an ['a], along with some user expressions that should lifted out of the |
| 5 | scope of internal bindings. For example, if a user writes [[@@default x]], they mean |
| 6 | [x] in the surface code, not some temporary variable [x] added by ppx machinery. *) |
| 7 | type 'a t |
| 8 | |
| 9 | (** As a monad, combines all client expressions so they can be lifted to the outermost |
| 10 | level of generated code. *) |
| 11 | include Monad.S with type 'a t := 'a t |
| 12 | |
| 13 | (** Lifts the given expression and binds it to a fresh variable starting with [prefix]. |
| 14 | The expression is evaluated each time it is referred to. The binding is annotated with |
| 15 | [ty]. Uses [loc] for generated code. *) |
| 16 | val create : loc:location -> prefix:string -> ty:core_type -> expression -> expression t |
| 17 | |
| 18 | (** Uses [let] to bind all lifted user expressions, with the contained expression as the |
| 19 | body. Should be called in whatever scope the user should be able to refer to. *) |
| 20 | val let_bind_user_expressions : expression t -> loc:location -> expression |