예제 #1
0
        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);
        }
예제 #2
0
파일: Stream.cs 프로젝트: stjordanis/sodium
 internal Stream <T> GateImpl(Behavior <bool> b) => this.SnapshotImpl(b, (a, pred) => pred ? MaybeInternal.Some(a) : MaybeInternal.None).FilterMaybeInternal();
예제 #3
0
 public static MaybeInternal <T> Some <T>(T value) => MaybeInternal <T> .Some(value);