public void Either_Maps() { Func<int, int> f = (x) => x + 3; var r = new Either.Right<string, int> (4); var res = r.FMap (f); Assert.IsTrue (res is Either.Right<string, int>); Assert.AreEqual ((res as Either.Right<string, int>).r, 7); var l = new Either.Left<string, int> ("blah"); res = l.FMap (f); Assert.IsTrue (res is Either.Left<string, int>); }
public void Either_Maps() { Func <int, int> f = (x) => x + 3; var r = new Either.Right <string, int> (4); var res = r.FMap(f); Assert.IsTrue(res is Either.Right <string, int>); Assert.AreEqual((res as Either.Right <string, int>).r, 7); var l = new Either.Left <string, int> ("blah"); res = l.FMap(f); Assert.IsTrue(res is Either.Left <string, int>); }