def test_functor_2nd_low(self): seq = Seq(1, 2, 3, 4, 5) def f(x): return x + 1 def g(x): return x * 2 self.assertEqual(seq.map(lambda x: f(g(x))), seq.map(g).map(f))
def test_functor_1st_low(self): seq = Seq(1, 2, 3, 4, 5) def identity(x): return x self.assertEqual(seq.map(identity), identity(seq))
def test_applicative_1st_low(self): seq = Seq(1, 2, 3, 4, 5) def f(x): return x + 1 self.assertEqual(seq.ap(Seq(f)), seq.map(f))