mapPointers can yield non-pointers
This commit is contained in:
parent
055b367764
commit
c46566e5a0
|
@ -68,9 +68,9 @@ export class IdentityFold<T extends object> extends ValueFold<T, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MapFold<T extends object, R extends object> extends ValueFold<T, R> {
|
export class MapFold<T extends object, R extends object> extends ValueFold<T, R> {
|
||||||
readonly f: (t: T) => R;
|
readonly f: (t: T) => Value<R>;
|
||||||
|
|
||||||
constructor(f: (t: T) => R) {
|
constructor(f: (t: T) => Value<R>) {
|
||||||
super();
|
super();
|
||||||
this.f = f;
|
this.f = f;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ export function fold<T extends object, R>(v: Value<T>, o: FoldMethods<T, R>): R
|
||||||
|
|
||||||
export function mapPointers<T extends object, R extends object>(
|
export function mapPointers<T extends object, R extends object>(
|
||||||
v: Value<T>,
|
v: Value<T>,
|
||||||
f: (t: T) => R,
|
f: (t: T) => Value<R>,
|
||||||
): Value<R>
|
): Value<R>
|
||||||
{
|
{
|
||||||
return fold(v, new MapFold(f));
|
return fold(v, new MapFold(f));
|
||||||
|
|
Loading…
Reference in New Issue