aboutsummaryrefslogtreecommitdiff
path: root/stubs/pymonad/maybe.pyi
blob: abf1433179b26effbd2da86ab5e2d22f5beea668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pymonad.monad  # type: ignore
from _typeshed import Incomplete
from typing import Any, Callable, Generic, TypeVar

S = TypeVar('S')
T = TypeVar('T')

class Maybe(pymonad.monad.Monad, Generic[T]):
    @classmethod
    def insert(cls, value: T) -> Maybe[T]: ...
    def amap(self, monad_value: Maybe[S]) -> Maybe[T]: ...
    def bind(self, kleisli_function: Callable[[S], Maybe[T]]) -> Maybe[T]: ...
    def is_just(self) -> bool: ...
    def is_nothing(self) -> bool: ...
    def map(self, function: Callable[[S], T]) -> Maybe[T]: ...
    def maybe(self, default_value: T, extraction_function: Callable[[S], T]) -> T: ...
    option: Incomplete
    def __eq__(self, other): ...

def Just(value: T) -> Maybe[T]: ...

Nothing: Maybe[Any]

class Option(Maybe[T]): ...

def Some(value: T) -> Option[T]: ...