Skip to content

Future

Future dataclass

Bases: Generic[A]

Future

Source code in funclift/types/future.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@dataclass
class Future(Generic[A]):
    """Future"""

    value: A | None

    def pure(self, a: A) -> Future[A]:
        return Future(a)

    def fmap(self, f: Callable[[A], B]) -> Future[B]:
        return FutureMonad.fmap(self, f)

    def flatmap(self, f: Callable[[A], Future[B]]) -> Future[B]:
        return FutureMonad.flatmap(self, f)