Example #1
0
 def test_composition_law(self, f: Unary, g: Unary, value):
     h = compose(f, g)
     assert Just(value).map(h) == Just(value).map(g).map(f)
     assert Nothing().map(h) == Nothing().map(g).map(f)
Example #2
0
 def test_composition_law(self, f, g, l):
     h = compose(f, g)
     assert l.map(h) == l.map(g).map(f)
Example #3
0
 def test_composition_law(self, f, g, value):
     h = compose(f, g)
     assert Done(value).map(g).map(f).run() == Done(value).map(h).run()
Example #4
0
 async def test_composition_law(self, f, g, value):
     h = compose(f, g)
     assert (await Done(value).map(g).map(f).run()
             ) == (await Done(value).map(h).run())
Example #5
0
 def test_composition_law(self, f, g, value, env):
     h = compose(f, g)
     assert (
         effect.success(value).map(h).run(env) ==
         effect.success(value).map(g).map(f).run(env)
     )
Example #6
0
 def test_composition_law(self, f: Unary, g: Unary, value):
     h = compose(f, g)
     assert Left(value).map(h) == Left(value).map(g).map(f)
     assert Right(value).map(h) == Right(value).map(g).map(f)