예제 #1
0
        public static void Test()
        {
            var x1 = Tainted <int> .Bind(Tainted <int> .MakeTainted(5), y => { return(Tainted <int> .MakeTainted(y)); });

            var x2 = Tainted <int> .Bind(Tainted <int> .MakeClean(5), y => { return(Tainted <int> .MakeClean(y)); });

            var x3 = Tainted <int> .MakeTainted(5);
        }
예제 #2
0
        public static Tainted <R> Bind <A, R>(
            Tainted <A> tainted, Func <A, Tainted <R> > function)
        {
            Tainted <R> result = function(tainted.Value);

            if (tainted.IsTainted && !result.IsTainted)
            {
                return(new Tainted <R>(result.Value, true));
            }
            else
            {
                return(result);
            }
        }