/** * Stores new binding in the map if it does not already exist. * * @tsplus static effect/core/stm/TMap.Aspects putIfAbsent * @tsplus pipeable effect/core/stm/TMap putIfAbsent */ export function putIfAbsent(k: K, v: V) { return (self: TMap): STM => self.get(k).flatMap((_) => _.fold(self.put(k, v), (_) => STM.unit)) }