functionalscript
Version:
FunctionalScript is a purely functional subset of JavaScript
20 lines (19 loc) • 927 B
TypeScript
import type * as Result from '../../types/result/module.f.ts';
import type { Io, Performance } from '../../io/module.f.ts';
import { type ModuleMap } from '../module.f.ts';
type Log<T> = (v: string) => (state: T) => T;
type Measure<T> = <R>(f: () => R) => (state: T) => readonly [R, number, T];
type Input<T> = {
readonly moduleMap: ModuleMap;
readonly log: Log<T>;
readonly error: Log<T>;
readonly measure: Measure<T>;
readonly state: T;
readonly tryCatch: <R>(f: () => R) => Result.Result<R, unknown>;
readonly env: (n: string) => string | undefined;
};
export declare const test: <T>(input: Input<T>) => readonly [number, T];
export declare const anyLog: (f: (s: string) => void) => (s: string) => <T>(state: T) => T;
export declare const measure: (p: Performance) => <R>(f: () => R) => <T>(state: T) => readonly [R, number, T];
export declare const main: (io: Io) => Promise<number>;
export {};