internal Behavior(Stream <T> stream, T initialValue) { this.stream = stream; this.valueProperty = initialValue; this.UsingInitialValue = true; this.streamListener = TransactionInternal.Apply( (trans1, _) => this.stream.Listen( Node <T> .Null, trans1, (trans2, a) => { this.valueUpdate.MatchNone( () => { trans2.Last( () => { this.valueUpdate.MatchSome(v => this.ValueProperty = v); this.valueUpdate = MaybeInternal.None; }); }); this.valueUpdate = MaybeInternal.Some(a); }, false), false); }
public static MaybeInternal <T> Some <T>(T value) => MaybeInternal <T> .Some(value);
internal Stream <T> GateImpl(Behavior <bool> b) => this.SnapshotImpl(b, (a, pred) => pred ? MaybeInternal.Some(a) : MaybeInternal.None).FilterMaybeInternal();