How to use the pfun.cont.value function in pfun

To help you get started, we’ve selected a few pfun examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github suned / pfun / tests / test_cont.py View on Github external
def test_stack_safety(self):
        with recursion_limit(100):
            cont.sequence([cont.value(v) for v in range(500)]).run(identity)
github suned / pfun / tests / test_cont.py View on Github external
def f():
            a = yield cont.value(2)
            b = yield cont.value(2)
            return a + b
github suned / pfun / tests / test_cont.py View on Github external
def test_left_identity_law(self, f, value):
        assert (
            cont.value(value).and_then(f).run(identity) == f(value
                                                             ).run(identity)
        )
github suned / pfun / tests / test_cont.py View on Github external
def test_inequality(self, first, second):
        assume(first != second)
        assert cont.value(first).run(identity) != cont.value(second
                                                             ).run(identity)
github suned / pfun / tests / test_cont.py View on Github external
def test_identity_law(self, value):
        assert (
            cont.value(value).map(identity).run(identity) ==
            cont.value(value).run(identity)
        )
github suned / pfun / tests / test_cont.py View on Github external
def test_stack_safety():
            for _ in range(500):
                yield cont.value(1)
            return None
github suned / pfun / tests / test_cont.py View on Github external
def test_identity_law(self, value):
        assert (
            cont.value(value).map(identity).run(identity) ==
            cont.value(value).run(identity)
        )
github suned / pfun / tests / test_cont.py View on Github external
def test_right_identity_law(self, value):
        assert (
            cont.value(value).and_then(
                cont.value
            ).run(identity) == cont.value(value).run(identity)
        )
github suned / pfun / tests / test_cont.py View on Github external
def test_equality(self, value):
        assert cont.value(value).run(identity) == cont.value(value
                                                             ).run(identity)