How to use pfun - 10 common examples

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_trampoline.py View on Github external
def test_stack_safety(self):
        with recursion_limit(100):
            sequence([Done(v) for v in range(500)]).run()
github suned / pfun / tests / type_tests / negatives / list_bind_arguments.py View on Github external
def test() -> List[int]:
    return List(['1', '2', '3']).and_then(lambda x: List([x**2]))
github suned / pfun / tests / type_tests / negatives / list_bind_return_type.py View on Github external
def test() -> List[str]:
    return List(i for i in (1, 2, 3)).and_then(lambda x: List([x**2]))
github suned / pfun / tests / test_effect.py View on Github external
        e = e.recover(lambda _: effect.success(''))
        with recursion_limit(100):
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_either.py View on Github external
def test_identity_law(self, value):
        assert Left(value).map(identity) == Left(value)
        assert Right(value).map(identity) == Right(value)
github suned / pfun / tests / test_either.py View on Github external
def test_map_m(self):
        assert map_m(Right, range(3)) == Right((0, 1, 2))
github suned / pfun / tests / test_either.py View on Github external
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)