import { Scope } from '../scope'; import { NeverType, NumberPrimitive, StringPrimitive, StructValueType, Type, UnionType, ValueType } from '../types'; export declare type Arg = T | UnionType | NeverType; export declare type ScopedFn Type> = (scope: Scope, ...args: Parameters) => ReturnType; export declare type UnaryFn = (a: Arg) => Arg; export declare type BinaryFn = (a: Arg, b: Arg) => Arg; export declare type TernaryFn = (a: Arg, b: Arg, c: Arg) => Arg; export declare type QuaternaryFn = (a: Arg, b: Arg, c: Arg, d: Arg) => Arg; export declare function wrapUnary(fn: (a: StringPrimitive) => Arg): UnaryFn; export declare function wrapUnary(fn: (a: NumberPrimitive) => Arg): UnaryFn; export declare function wrapUnary(fn: (a: A) => Arg): UnaryFn; export declare const wrapScopedUnary: (fn: (scope: Scope, a: T) => Arg) => ScopedFn>; export declare const wrapBinary: (fn: (a: A, b: B) => Arg) => BinaryFn; export declare const wrapScopedBinary: (fn: (scope: Scope, a: A, b: B) => Arg) => ScopedFn>; export declare const wrapTernary: (fn: (a: A, b: B, c: C) => Arg) => TernaryFn; export declare const wrapScopedTernary: (fn: (scope: Scope, a: A, b: B, c: C) => Arg) => ScopedFn>; export declare const wrapQuaternary: (fn: (a: A, b: B, c: C, d: D) => Arg) => QuaternaryFn; export declare const wrapScopedQuaternary: (fn: (scope: Scope, a: A, b: B, c: C, d: D) => Arg) => ScopedFn>; export declare type ReducerVarArgsFn = (...args: Arg[]) => Arg; export declare function wrapReducerVarArgs(neutral: Arg, fn: (a: StringPrimitive, b: StringPrimitive) => Arg): ReducerVarArgsFn; export declare function wrapReducerVarArgs(neutral: Arg, fn: (a: NumberPrimitive, b: NumberPrimitive) => Arg): ReducerVarArgsFn; export declare function wrapReducerVarArgs(neutral: Arg, fn: (a: StructValueType, b: StructValueType) => Arg): ReducerVarArgsFn; export declare function wrapReducerVarArgs(neutral: Arg, fn: (a: T, b: T) => Arg): ReducerVarArgsFn; export declare const wrapScopedReducerVarArgs: (neutral: Arg, fn: (scope: Scope, a: T, b: T) => Arg) => ScopedFn>; /** * This function differs from {@link wrapReducerVarArgs} in that it will try to reduce widening. * * Navi function are allowed to return a superset of the actual result. This is what makes it * possible for Navi to expressive, but it also creates problems. In particular, it breaks * associativity. * * This function tries to makes this problem a little better. It will reorder arguments in hopes of * reducing potential widening. In practice, it will process numeric literals before anything else. */ export declare const wrapAssociativeCommutativeReducerVarArgs: (neutral: Arg, fn: (a: NumberPrimitive, b: NumberPrimitive) => Arg) => ReducerVarArgsFn; export declare const makeScoped: (fn: (...args: T) => R) => (scope: Scope, ...args: T) => R;