Defines a native function in the module.
If the function needs to call into Backolon code, it can do so by updating the current cookie on the task to remember where it is in execution and then calling task.enter(code, loc, env) with the appropriate code, location, and environment.
The function should "return" its result by calling task.out(result). If the Javascript function does not call task.out() and just returns, the scheduler will call the implementation again until it does, so it's important to call task.out() at some point to avoid infinite loops.
The string describing the function signature, the same way as in lambda headers in Backolon code. For example, "_:map" for a function taking a single map argument, or "x y" for a function taking two arguments of any type.
Whether to also define a variable with the function's name pointing to the function itself (thus making the function accessible from Backolon code).
Defines a new pattern syntax. The handler can be either a native function implementation, or a Backolon function defined in the same module (in either case the handler will be called with the pattern variables as a single map argument).
The pattern string, in the same format as in Backolon patterns. For example, "x:roundblock" for a pattern matching a single round block and binding it to x, or "x:number y:string" for a pattern matching a number followed by a string and binding them to x and y respectively.
Whether the pattern is right-associative (only matters for patterns that can be chained, like infix operators).
Which block types may contain this pattern. null is equivalent to [ThingType.roundblock, ThingType.topblock].
The name of the native function implementing the pattern rewriter.
OptionalhandlerBody: (task: Task, state: StackEntry) => voidIf present, the native function implementation of the pattern rewriter. If not present, the handler is expected to be defined elsewhere (e.g. by a call to defun in the same module) and this function will just reference it by name.
Defines a new operator overload native function, mapping to the given operator name.
The name to give the builtin function implementing the operator overload (e.g. "__add" for overloading the "add" operator).
The operator name to overload (e.g. "add").
Defines a new operator overload for the given operator name and argument types. The handler will be called with the operator arguments as an array, and should return the result of the operator application.
List of argument types for this overload, where each type can be a ThingType, a string representing a type class, or null for any type. The length of this list determines the arity of the operator overload.
Defines a custom applicator for a given type of functor. The applicator will be called with the functor, arguments, and callsite information whenever an apply form with a functor of the given type is evaluated in Backolon code.
Native module container for Backolon builtins, syntax, and operators.