summaryrefslogtreecommitdiff
path: root/u/fn/callable.ts
blob: fc6ea814364073381ea99e0a1aa8fbec20e91d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// deno-lint-ignore no-explicit-any
export interface Callable<T = any, ArgT = any> {
  (...args: Array<ArgT>): T;
}

export interface Supplier<T> extends Callable<T, undefined> {
  (): T;
}

export interface Mapper<T, U> extends Callable<U, T> {
  (t: T): U;
}

export interface BiMapper<T, U, R> extends Callable {
  (t: T, u: U): R;
}

export interface SideEffect<T> extends Mapper<T, void> {
}

export interface BiSideEffect<T, U> extends BiMapper<T, U, void> {
}