diff options
Diffstat (limited to 'u/trace/itrace.ts')
-rw-r--r-- | u/trace/itrace.ts | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/u/trace/itrace.ts b/u/trace/itrace.ts index ed707c5..35164b5 100644 --- a/u/trace/itrace.ts +++ b/u/trace/itrace.ts @@ -9,29 +9,29 @@ export interface ITrace<TraceWith> { } export type ITraceableTuple<T, TraceWith> = [T, BaseTraceWith | TraceWith]; -export type ITraceableMapper<T, U, TraceWith, W = ITraceable<T, TraceWith>> = ( +export type ITraceableMapper<T, _T, TraceWith, W = ITraceable<T, TraceWith>> = ( w: W, -) => U; +) => _T; export interface ITraceable<T, Trace = BaseTraceWith> { readonly trace: ITrace<Trace>; get: Supplier<T>; - move: <U>(u: U) => ITraceable<U, Trace>; - map: <U>(mapper: ITraceableMapper<T, U, Trace>) => ITraceable<U, Trace>; - bimap: <U>( + move: <_T>(u: _T) => ITraceable<_T, Trace>; + map: <_T>(mapper: ITraceableMapper<T, _T, Trace>) => ITraceable<_T, Trace>; + bimap: <_T>( mapper: ITraceableMapper< T, - ITraceableTuple<U, Array<Trace> | Trace>, + ITraceableTuple<_T, Array<Trace> | Trace>, Trace >, - ) => ITraceable<U, Trace>; + ) => ITraceable<_T, Trace>; peek: (peek: ITraceableMapper<T, void, Trace>) => ITraceable<T, Trace>; - flatMap: <U>( - mapper: ITraceableMapper<T, ITraceable<U, Trace>, Trace>, - ) => ITraceable<U, Trace>; - flatMapAsync<U>( - mapper: ITraceableMapper<T, Promise<ITraceable<U, Trace>>, Trace>, - ): ITraceable<Promise<U>, Trace>; + flatMap: <_T>( + mapper: ITraceableMapper<T, ITraceable<_T, Trace>, Trace>, + ) => ITraceable<_T, Trace>; + flatMapAsync<_T>( + mapper: ITraceableMapper<T, Promise<ITraceable<_T, Trace>>, Trace>, + ): ITraceable<Promise<_T>, Trace>; } export class TraceableImpl<T, TraceWith> implements ITraceable<T, TraceWith> { @@ -40,20 +40,20 @@ export class TraceableImpl<T, TraceWith> implements ITraceable<T, TraceWith> { public readonly trace: ITrace<TraceWith>, ) {} - public map<U>(mapper: ITraceableMapper<T, U, TraceWith>) { + public map<_T>(mapper: ITraceableMapper<T, _T, TraceWith>) { const result = mapper(this); return new TraceableImpl(result, this.trace); } - public flatMap<U>( - mapper: ITraceableMapper<T, ITraceable<U, TraceWith>, TraceWith>, - ): ITraceable<U, TraceWith> { + public flatMap<_T>( + mapper: ITraceableMapper<T, ITraceable<_T, TraceWith>, TraceWith>, + ): ITraceable<_T, TraceWith> { return mapper(this); } - public flatMapAsync<U>( - mapper: ITraceableMapper<T, Promise<ITraceable<U, TraceWith>>, TraceWith>, - ): ITraceable<Promise<U>, TraceWith> { + public flatMapAsync<_T>( + mapper: ITraceableMapper<T, Promise<ITraceable<_T, TraceWith>>, TraceWith>, + ): ITraceable<Promise<_T>, TraceWith> { return new TraceableImpl( mapper(this).then((t) => t.get()), this.trace, @@ -65,14 +65,14 @@ export class TraceableImpl<T, TraceWith> implements ITraceable<T, TraceWith> { return this; } - public move<Tt>(t: Tt): ITraceable<Tt, TraceWith> { + public move<_T>(t: _T): ITraceable<_T, TraceWith> { return this.map(() => t); } - public bimap<U>( + public bimap<_T>( mapper: ITraceableMapper< T, - ITraceableTuple<U, Array<TraceWith> | TraceWith>, + ITraceableTuple<_T, Array<TraceWith> | TraceWith>, TraceWith >, ) { |