예제 #1
0
        public void ReaderSelectManyTest01()
        {
            var m11   = new MonadPrimus.Reader <string, int>(x => int.Parse(x) + 1);
            var m12   = m11.SelectMany(x => new MonadPrimus.Reader <string, string>(s => x + s));
            var res11 = m12.RunReader("1");

            Assert.AreEqual("21", res11);
        }
예제 #2
0
        public void ReaderMonadRule2Test()
        {
            var m00   = new MonadPrimus.Reader <string, int>(x => int.Parse(x) + 1);
            var m11   = m00.SelectMany(MonadPrimus.ToReader <string, int>);
            var m12   = m00;
            var res11 = m11.RunReader("1");
            var res12 = m12.RunReader("1");

            Assert.AreEqual(2, res11);
            Assert.AreEqual(2, res12);
        }