functionalscript
Version:
FunctionalScript is a purely functional subset of JavaScript
39 lines (38 loc) • 1.43 kB
TypeScript
import { type List, type Thunk } from '../../types/list/module.f.ts';
import type { Array1, Array2, Array3 } from '../../types/array/module.f.ts';
/**
* An unsigned 8-bit integer, represents a single byte.
*/
export type U8 = number;
/**
* A singed 32-bit integer.
*/
export type I32 = number;
/**
* Represents an unsigend 8-bit type - U8 or the end-of-file indicator.
* The U8 represents the byte itself, and null indicates that reading does not return anything else.
*/
export type ByteOrEof = U8 | null;
/**
* Represents the state of a UTF-8 decoding operation that contains at least one byte.
*/
export type Utf8NonEmptyState = Array1<number> | Array2<number> | Array3<number>;
/**
* Represents the state of a UTF-8 decoding operation, which can be either `null` (no state)
* or a non-empty state containing one or more bytes.
*/
export type Utf8State = null | Utf8NonEmptyState;
/**
* Maps a list of Unicode code points to a stream of UTF-8 bytes.
*
* @param input - A list of Unicode code points to be converted.
* @returns A thunk that lazily produces a sequence of UTF-8 bytes.
*/
export declare const fromCodePointList: (input: List<number>) => Thunk<U8>;
/**
* Converts a list of UTF-8 bytes into a list of Unicode code points.
*
* @param input - A list of UTF-8 bytes.
* @returns A list of Unicode code points or error codes.
*/
export declare const toCodePointList: (input: List<U8>) => List<I32>;