UNPKG

functionalscript

Version:

FunctionalScript is a purely functional subset of JavaScript

25 lines (24 loc) 1.21 kB
import { type CsiConsole } from '../../text/sgr/module.f.ts'; import type * as Result from '../../types/result/module.f.ts'; import type { Io, Performance, TryCatch } from '../../io/module.f.ts'; import { type ModuleMap } from '../module.f.ts'; type Log<T> = CsiConsole; 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 isTest: (s: string) => boolean; export type Test = () => unknown; export type TestSet = Test | readonly (readonly [string, unknown])[]; export declare const parseTestSet: (t: TryCatch) => (x: unknown) => TestSet; 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 {};