Note down that map/flatMap must be removed

This commit is contained in:
Aria Minaei 2022-11-26 22:40:04 +01:00
parent 6d7d461223
commit 83832ef85b
3 changed files with 4 additions and 0 deletions

View file

@ -256,6 +256,7 @@ export default abstract class AbstractDerivation<V> implements IDerivation<V> {
* @deprecated This is a remnant of the old monadic api. Now it's functionally equal to `prism(() => fn(der.getValue()))`, so use that instead.
*/
map<T>(fn: (v: V) => T): IDerivation<T> {
// TODO once prism and AbstractDerivation are merged into one, we should replace this with prism(() => fn(der.getValue()))
return map(this, fn)
}
@ -279,6 +280,7 @@ export default abstract class AbstractDerivation<V> implements IDerivation<V> {
flatMap<R>(
fn: (v: V) => R,
): IDerivation<R extends IDerivation<infer T> ? T : R> {
// TODO once prism and AbstractDerivation are merged into one, we should replace this with prism(() => val(fn(val(der))))
return flatMap(this, fn)
}
}

View file

@ -10,6 +10,7 @@ enum UPDATE_NEEDED_FROM {
}
const makeFlatMapDerivationClass = () => {
// TODO once prism and AbstractDerivation are merged into one, we should delete this file
class FlatMapDerivation<V, DepType> extends AbstractDerivation<V> {
private _innerDerivation: undefined | null | IDerivation<V>
private _staleDependency: UPDATE_NEEDED_FROM

View file

@ -3,6 +3,7 @@ import type {IDerivation} from './IDerivation'
// Exporting from a function because of the circular dependency with AbstractDerivation
const makeMapDerivationClass = () =>
// TODO once prism and AbstractDerivation are merged into one, we should delete this file
class MapDerivation<T, V> extends AbstractDerivation<V> {
constructor(
private readonly _dep: IDerivation<T>,