From 83832ef85b43f312034e00f31eeee21805e00754 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sat, 26 Nov 2022 22:40:04 +0100 Subject: [PATCH] Note down that map/flatMap must be removed --- packages/dataverse/src/derivations/AbstractDerivation.ts | 2 ++ packages/dataverse/src/derivations/flatMap.ts | 1 + packages/dataverse/src/derivations/map.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/packages/dataverse/src/derivations/AbstractDerivation.ts b/packages/dataverse/src/derivations/AbstractDerivation.ts index ee5972c..1b0e25a 100644 --- a/packages/dataverse/src/derivations/AbstractDerivation.ts +++ b/packages/dataverse/src/derivations/AbstractDerivation.ts @@ -256,6 +256,7 @@ export default abstract class AbstractDerivation implements IDerivation { * @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(fn: (v: V) => T): IDerivation { + // 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 implements IDerivation { flatMap( fn: (v: V) => R, ): IDerivation ? 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) } } diff --git a/packages/dataverse/src/derivations/flatMap.ts b/packages/dataverse/src/derivations/flatMap.ts index a35c6f0..d4fa2ba 100644 --- a/packages/dataverse/src/derivations/flatMap.ts +++ b/packages/dataverse/src/derivations/flatMap.ts @@ -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 extends AbstractDerivation { private _innerDerivation: undefined | null | IDerivation private _staleDependency: UPDATE_NEEDED_FROM diff --git a/packages/dataverse/src/derivations/map.ts b/packages/dataverse/src/derivations/map.ts index 5f5a6f1..78c661e 100644 --- a/packages/dataverse/src/derivations/map.ts +++ b/packages/dataverse/src/derivations/map.ts @@ -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 extends AbstractDerivation { constructor( private readonly _dep: IDerivation,