Esempio n. 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);
        }
Esempio n. 2
0
 public static MaybeInternal <T> Some <T>(T value) => MaybeInternal <T> .Some(value);
Esempio n. 3
0
 internal Stream <T> GateImpl(Behavior <bool> b) => this.SnapshotImpl(b, (a, pred) => pred ? MaybeInternal.Some(a) : MaybeInternal.None).FilterMaybeInternal();