public void SecondFunctorLawHoldsForSelectLeft(IEither <string, int> e) { bool f(int x) => x % 2 == 0; int g(string s) => s.Length; Assert.Equal( e.SelectLeft(x => f(g(x))), e.SelectLeft(g).SelectLeft(f)); }
public void ConsistencyLawHolds(IEither <string, int> e) { bool f(string s) => string.IsNullOrWhiteSpace(s); DateTime g(int i) => new DateTime(i); Assert.Equal(e.SelectBoth(f, g), e.SelectRight(g).SelectLeft(f)); Assert.Equal( e.SelectLeft(f).SelectRight(g), e.SelectRight(g).SelectLeft(f)); }
public void SelectLeftObeysFirstFunctorLaw(IEither <string, int> e) { Assert.Equal(e, e.SelectLeft(Id)); }